Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / dbChangeMouse

Author
Message
jsmurthy4
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location:
Posted: 15th Jun 2008 16:40 Edited at: 15th Jun 2008 17:26
Hi friends,
i am new to gdk i want to change cursor.i found
" void dbChangeMouse ( int iCursor ) Values 2 to 31 are custom cursors that can be specified in the project media section and selected with this command "
i didn't understand how to set custom icon?
i mean i am using vc++ express(free edition). so how to create resource.h file or resorce.rc which one? and how?
then after creating how to insert icon in detail.
Thanks in advance

Help me
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 16th Jun 2008 02:38 Edited at: 16th Jun 2008 02:43
That documentation is held over from DarkBasic Professional. I am not certain that that functionaltiy is held over to GDK, but it doesn't matter anyway because you can change the mouse cursor with Windows.

So, I will answer with Windows related information, and leave the explanation of GDK to someone who knows better than I.

You would need to use both resource.h and projname.rc to produce resources embedded in your .exe file...which you can do in VS2008, but you must make the files yourself...there is no resource editing capability in Express editions of MS products. I could post a sample of each...in fact I have already done that several times over the last 4 months; they shouldn't be difficult to find using search. resource.h defines the resource IDs symbolically, and the .rc file has the structures that the resource compiler uses to make the "image" in your executable. (VS Express has the resource compiler...it just doesn't have the editor.)

You don't need to do that, however...you can just use the Windows function LoadImage, or even the deprecated LoadCursor function with the appropriate parameters. Once you have an HCURSOR, you can use the Windows function SetCursor to change it. LoadCursor and LoadImage both require an HINSTANCE, which you can get several ways, but the easiest way to get it is from the core of GDK itself. I also posted code on how to do that recently. Note that the return from SetCursor is the previous cursor's HCURSOR, which you can save to restore the original one, if that is your wont.

Basically, you will need to add an include file to your source (probably main.cpp in your case...up at the top, where it says #include "DarkGDK.h") The include file is "GlobStruct.h". I do not believe that GlobStruct is documented, nor is the function to get the address of GlobStruct.

Next, you will need a variable to hold the pointer:
GlobStruct* ptrCore = NULL;

At the top of the DarkGDK function, put the following line in:
ptrCore = (GlobStruct*)dbGetGlobPtr();

The HINSTANCE that you will need to use in order to call those Windows functions is:
ptrCore->hInstance

Also in the same structure is the HANDLE to the window:
ptrCore->hWnd

A quick read of GlobStruct.h will reveal a great deal of useful information. It is in the GDK include file directory with the rest of GDK's include files.
jsmurthy4
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location:
Posted: 16th Jun 2008 07:54
thanks jinzai for reply
It will be great help if u post some code or example or links.

Login to post a reply

Server time is: 2024-09-29 23:35:30
Your offset time is: 2024-09-29 23:35:30