Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Weird Code Problem

 
Post new topic   Reply to topic Printable version
 View previous topic  IBasic? Post :: Post Quick Question #2  View next topic  
Author Message
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Dec 10, 2004 5:36 pm   Post maybe stupid    Post subject: Weird Code Problem Reply to topic Reply with quote

My
Code: Show/Hide
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
Code: Show/Hide
// 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
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri Dec 10, 2004 6:43 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

What is _W64?
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Dec 10, 2004 6:54 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

I have no clue, but it doesn't matter now. icon_razz.gif 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
View users profile Send private message Add User to Ignore List Visit posters website
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Fri Dec 10, 2004 7:37 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Looks like a game, can we see screenshots or a link?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Fri Dec 10, 2004 8:01 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Probably an editor icon_wink.gif
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Dec 12, 2004 3:19 pm   Post maybe stupid    Post subject: Another Problem Reply to topic Reply with quote

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. icon_razz.gif) 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.

Code: Show/Hide
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
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sun Dec 12, 2004 6:58 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Quote:
I wasn't dividing sizeof(PropSheetButtons) by sizeof(WORD)


Should use: sizeof(PropSheetButtons) / sizeof(PropSheetButtons[0])
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Dec 12, 2004 10:35 pm   Post maybe stupid    Post subject: Reply to topic Reply with quote

Hey... that's a good idea... Thanks!

(Why can't I think of these things?)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Tue Dec 14, 2004 1:12 am   Post maybe stupid    Post subject: Reply to topic Reply with quote

Thats why HIS grim reaper is digital while we're stuck with analog
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Trash Talk All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 35 page(s) served in previous 5 minutes.

phpBB Created this page in 0.588147 seconds : 34 queries executed (86.8%): GZIP compression disabled