COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 07-03-2023, 11:53 PM   #1
FelixMagi
Human being with feelings
 
FelixMagi's Avatar
 
Join Date: Mar 2016
Posts: 47
Default Cannot edit or even read information about a RichEdit

I added a RichEdit in my control:
Code:
HWND CreateRich(HWND hWnd, int X, int Y, int W, int H) {
  HWND hEl;
  HINSTANCE mHInstance=0;
  LoadLibrary("Riched20.dll");
  hEl=CreateWindow(RICHEDIT_CLASS, "",
        ES_MULTILINE | WS_VISIBLE | WS_CHILD | ES_READONLY, X, Y, W, H, hWnd, NULL, mHInstance, NULL);
  HFONT hfont = CreateFont(15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
  SendMessage(hEl,  WM_SETFONT, (WPARAM)hfont,  MAKELPARAM(FALSE,0));
  SendMessage(hEl, EM_SETBKGNDCOLOR, 0, RGB(15, 15, 15));
  SetFocus(hEl);
  return hEl;
}
.....
  hLogs=CreateInput((HWND)mPlug->GetGUI()->GetWindow(), x, y, w, h);
It seems that I cannot edit or even read information about a RichEdit outside of Draw().

The program crashes even if I call SendMessage(hLogs, EM_GETLINECOUNT, 0, 0); - very strange. Why is this happening ?

I need to edit this control outside of Draw()

How can I do this?

Last edited by FelixMagi; 07-04-2023 at 03:18 AM.
FelixMagi is offline   Reply With Quote
Old 07-04-2023, 03:04 AM   #2
FelixMagi
Human being with feelings
 
FelixMagi's Avatar
 
Join Date: Mar 2016
Posts: 47
Default

I see
Code:
HFONT hfont = (HFONT)SendMessage((HWND)mPlug->GetGUI()->GetWindow(), WM_GETFONT, NULL, NULL);
crash the plugin as well, this means serious problems in the Windows API implementation.

Last edited by FelixMagi; 07-04-2023 at 04:19 AM.
FelixMagi is offline   Reply With Quote
Old 07-04-2023, 04:56 AM   #3
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,631
Default

Maybe mPlug or mPlug->GetGUI() is somehow NULL?
Tale is online now   Reply With Quote
Old 07-04-2023, 05:36 AM   #4
FelixMagi
Human being with feelings
 
FelixMagi's Avatar
 
Join Date: Mar 2016
Posts: 47
Default

Code:
    if (mPlug->GetGUI()!=NULL && mPlug->GetGUI()->GetWindow()!=NULL)
      SendMessage((HWND)mPlug->GetGUI()->GetWindow(), WM_GETFONT, NULL, NULL);
crash too
FelixMagi is offline   Reply With Quote
Old 07-04-2023, 06:32 AM   #5
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 229
Default

Works from anywhere, not just from the Draw(), but not from ProcessDoubleReplacing(). Check better here, you cannot call SendMessage() from ProcessDoubleReplacing.
__________________
Audio plugins | BrainWaveProducer | EmRysRa
SaschArt is offline   Reply With Quote
Old 07-04-2023, 07:03 AM   #6
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,631
Default

Yeah, you should probably call this from the GUI thread. Here is seems to work fine if I call it from e.g. IControl::OnMouseDblClick(). Do note it seems to return NULL though.
Tale is online now   Reply With Quote
Old 07-04-2023, 10:42 PM   #7
FelixMagi
Human being with feelings
 
FelixMagi's Avatar
 
Join Date: Mar 2016
Posts: 47
Default

Quote:
Originally Posted by SaschArt View Post
Works from anywhere, not just from the Draw(), but not from ProcessDoubleReplacing(). Check better here, you cannot call SendMessage() from ProcessDoubleReplacing.
Indeed, that was it, problem solved
FelixMagi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.