Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

drarem

turn a win32 exe into a reusable control?

This topic is 5468 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here''s the thing, I''ve created a simple control which uses the callback functions for the WM_MOUSEMOVE/WM_LBUTTONDOWN/etc messages (win32/GDI) - move mouse over point on grid, change color, move point when mousebutton is down, etc.. I would like to make it reusable, so that all I have to do is something like: CGui g_editor; // instance of class CGui :: :: :: :: mainloop() { g_editor.UpdateControl(g_hwnd); } then ideally it would respond to my mouse messages or any other input I add into it later.. how would I set that up, as a callback (or a thread)? Do I need to RegisterEx() another window for my small control I want to place on my client window? And then do another CreateWindowEx() in WinMain? Or would it be better to use the GetAsyncKeyState(VK_LBUTTON) and drop the callback altogether? I fseek, therefore I fam.

Share this post


Link to post
Share on other sites
Advertisement
I commented out my callback function and changed my mouse input into:


if (GetAsyncKeyState(VK_LBUTTON)) ....

when I move my mouse around with the button down, the mouse lags behind and comes to almost a crawl, it''s almost as if the puter is moving my mouse... creeepy..

would it be due to some buffer that needs flushing? if so how?

I fseek, therefore I fam.

Share this post


Link to post
Share on other sites
looks like one sure way is using a MDI window, hope I can stuff it into a class and forgit the painful parts of coding it..

I fseek, therefore I fam.

Share this post


Link to post
Share on other sites
If you want to create a custom control that can be used by several applications, do the following:
1) Create a DLL for the custom control
2) In your application, load the DLL
3) In the DLL''s DllMain function, when a DLL_PROCESS_ATTACH event occurs, register the control''s window class with the CS_GLOBALCLASS style
4) In your application, create an instance of the control using CreateWindowEx (ex_style, "control name", ...).
5) Get and set properties using the SendMessage function.

Your control will automatically receive WM_MOUSEMOVE, WM_KEYUP, etc messages when it has the focus / mouse is over it.

Hope that helps.

Skizz

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!