 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Fri Dec 10, 2004 5:36 pm Post maybe stupid Post subject: Weird Code Problem |
 |
|
|
|
My
INT_PTR CALLBACK IMsgsWndProc(HWND page, UINT msg, WPARAM wParam, LPARAM lParam);
//and so on...
DLGPROC procs[NUM_PAGES] =
{
&IMsgsWndProc,
&PlyWndProc,
&VictWndProc,
&DisWndProc,
&MapWndProc,
&UnitWndProc,
&TrigWndProc
}; |
Mircosoft's
// The INT_PTR is guaranteed to be the same size as a pointer.
typedef _W64 int INT_PTR, *PINT_PTR;
typedef INT_PTR (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM); |
Error C2440:
'initializing' : cannot convert from 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)' to 'int (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Apparently, the DialogProcs I'm defining myself with the same exact declaraction as DLGPROC are getting a return value of long while DLGPROC itself is getting a return value of int. Huh?? Am I missing something obvious? _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Fri Dec 10, 2004 6:43 pm Post maybe stupid Post subject: |
 |
|
|
|
What is _W64? _________________ 4,691 irradiated haggis! |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Fri Dec 10, 2004 6:54 pm Post maybe stupid Post subject: |
 |
|
|
|
I have no clue, but it doesn't matter now. Turns out that after 3 days of thinking over this, the solution pops into my head right after posting for help.
Although the file compiled right under MS Visual Studio (which I now realize I should have mentioned), it didn't work from the command line, as shown above. The problem was that the %INCLUDE% variable set by vcvars32.bat didn't have my updated MS Platform SDK before the old one inlcluded with VC. Sorry for the waste of time.
Moral of the story: Well, uhhh, I don't really know. I guess always remember that a weird error is probably old versions of include files? |
|
Back to top |
|
 |
Smong Server Help Squatter

Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Fri Dec 10, 2004 7:37 pm Post maybe stupid Post subject: |
 |
|
|
|
Looks like a game, can we see screenshots or a link? |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Fri Dec 10, 2004 8:01 pm Post maybe stupid Post subject: |
 |
|
|
|
Probably an editor  _________________ Performance is often the art of cheating carefully. - James Gosling |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Dec 12, 2004 3:19 pm Post maybe stupid Post subject: Another Problem |
 |
|
|
|
OK, I know I had replied here with my 2nd weird problem but somehow it got deleted... oh well.
First of all, Cyhper's completely right. It's an editor for Age of Empires II: AOK Trigger Studio. It's in very beta stages right now, and I haven't released an update in ages, but I have put a lot of work into it. (Oh, and just for your comfort, Ekted, I am now in the process of converting from stream wrappers to the basic CRT FILE streams.)
Secondly, the main reason I replied was a strange error I was getting with the property sheet. (Since it's an editor, I just made the main window a property sheet with no parent. Yes, very cheap, I know. ) Anyway, lately I had had a problem that whatever the first page was, it wouldn't be displayed until you reselected it (even though it received PSN_SETACTIVE). And the solution was just as weird.
WORD PropSheetButtons[] = { IDOK, IDCANCEL, IDHELP };
//remove buttons
for (int i = 0; i < sizeof(PropSheetButtons); i++)
{
HWND hWnd = GetDlgItem(sheet, PropSheetButtons[i]);
if (hWnd != NULL)
{
ShowWindow(hWnd, SW_HIDE);
EnableWindow(hWnd, FALSE);
}
} |
The above code was in WinMain() where it had been sitting for ages with no problem. However, in a completely random move of mine, I commented it out and voila! the bug disappeared! So, I moved it down to PSCB_INITIALIZED (in my PropSheetProc), and it still worked. I'm just to let it sit there (since it does seem more sensical to me) but I'd really like to know what that was causing such a strange error.
Edit: OK, as I was reading over my post, I realized what the problem was. Lately I've been going over my code for better readability and I had changed PropSheetButtons[] from a char array to a WORD array, since that's really what dialog IDs are. However, as you can see, I wasn't dividing sizeof(PropSheetButtons) by sizeof(WORD). Oops. One of the extra data the loop read must have been the HWND to the page itself or something. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sun Dec 12, 2004 6:58 pm Post maybe stupid Post subject: |
 |
|
|
|
Quote: | I wasn't dividing sizeof(PropSheetButtons) by sizeof(WORD) |
Should use: sizeof(PropSheetButtons) / sizeof(PropSheetButtons[0]) |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Dec 12, 2004 10:35 pm Post maybe stupid Post subject: |
 |
|
|
|
Hey... that's a good idea... Thanks!
(Why can't I think of these things?) |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Tue Dec 14, 2004 1:12 am Post maybe stupid Post subject: |
 |
|
|
|
Thats why HIS grim reaper is digital while we're stuck with analog _________________
 |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 35 page(s) served in previous 5 minutes.
|