|
Jason Henderson wrote:
There aren't a whole lot of modes, why not just use a static array of say 50 DEVMODE structs?
Because it's wrong and will fail. Actually, a program (game demo) I tested just the other day had exactly this hardcoded limit and failed miserably. You weren't involved in that code by any chance? :->
At this machine (a plain NT5 machine with a reasonably good monitor) I currently have 144 different display modes. If I swicth to a "hotter" Gfx card I'll surely get over 200 different modes.
If you don't want your app to fail, don't use hard-coded limits for stuff like this.
|
|
|
|
|
Mike Nordell wrote:
You weren't involved in that code by any chance?
No.
I had no idea there would be that many modes. It was just a suggestion.
Jason Henderson quasi-homepage articles "Like it or not, I'm right!"
|
|
|
|
|
Why use a plain array when there are so many good collection classes already in C++. A plain std::vector seems to be the final storage type for this, but while enumerating you could use just about whatever collection type you like.
|
|
|
|
|
Thanks for the suggestions. After a little thought I decided to go with the std::vector method, because it is dynamic and will only take up the required amount of precious memory. I can always set a limit to the number of modes I want to read in, but at least the memory allocation will be efficient...
Thanks for the suggestion guys, very much appreciated.
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Hi all,
I have an MFC application that I is working in debug mode. However when I build it in Release mode, it appears to me that the global instance of my CWinApp derived class does not exist in the application. Therefore when the app goes to reference that object, it is referencing bad memory and the application crashes.
Does anybody know of a project setting, include file, or piece of code that would cause this problem, or does anyone at least know how to fix this?
Any insight would be greatly appreciated.
Thanks
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I think there is a bug in your application. It is declared like CMyApp the App; , so it exists regardless of the configuration. Could you please show some code when you reference that object?
Best regards,
Alexandru Savescu
|
|
|
|
|
You may be right about the problem being with my code. But I can get both debug and release builds to compile and start running.
The one main thing that confuses me is that the winApp object is present and gets initialized in debug mode, but it is like it never gets initialized or recognized in Release mode. So the first time that the winapp object is referenced it crashes.
If I trace to where MFC gets its pointer to the WinApp object (inside of the MFC source code), and I type the name of the Winapp variable in the watch window, it does not recognize the variable and thinks that it does not exist.
As far as posting some code what would you like to see? My instance of the CWinApp object is declared like this inside of my main cpp file:
CAMClientApp theApp;
It is declared like this in the matchin header file:
extern CAMClientApp theApp;
Thanks for your help, if you have any other ideas I would like to hear them.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Try to not declare it extern in the header file and use the AfxGetApp() function to refer it. If it still crashes, compile the realese with debug information and try some debugging.
Best regards,
Alexandru Savescu
|
|
|
|
|
I would like to let everyone know that I have narrowed it down to the optimizations setting in the project properties.
If I change the setting to anything but "default" or "disable", I get this weird problem. I allow function inlining and that seems to be ok.
After my deadline I will do customized optimizations and see if I can narrow it down to the optimization that is causing this problem.
In the meantime if anyone else has any ideas to what could cause this weird problem that I am seeing, I would really appreciate your feedback.
Thank you,
Paul
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
my problem is : I have an exe which has used SDK & is coded in c & c++.Now i have to give Doc/View Architecture support to the exe for implementing some functionality of MFC.
I tried to make a regular Dll (having Doc/View arch' & exporting a function to be used by exe) but it didnt work proprely
Can anyone suggest me the way to do the above
surbinsho
|
|
|
|
|
I was following Mauricio Ritter's intro, http://www.codeproject.com/directx/BasicDD.asp
when I realized that after I alt-tab'ed out of the program, I can no longer go back in. How should I modify the code so that I can reenter the program?
Thanks
|
|
|
|
|
I have the handle of the iexploerer window,now I want send a message to back or forward the page.
Any function or Message?
Best Regards!
|
|
|
|
|
how can u return the value of an unsigned char...example code:
----example code-------
typedef{unsigned char data[16]}data_out;
----end code-----------
|
|
|
|
|
I hate typedefs, and this one is totallystupid.
unsigned char c = *(&data_out + 2);
gets you the third element ( data[2] )
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
|
i guess server socket must be on NT Server platform and client socket can be on any platform (95/98/200/station etc.).
is the 'guess' right?
if i install more software, can i run them on different plateform?
thanks.
includeh10
|
|
|
|
|
No no, a server socket is simply any socket on any platform which is listening for a connection.
a client socket can be any socket which is connected to a server socket.
This has nothing to do with the fact that the actual computer is a server or client. a server machine can connect to your personal computer, but its socket is still called the 'client' socket.
There may be limits on the number of connections an OS can accept at once, etc., but still, that doesnt stop you from using even windows 3.1 sockets as 'server' sockets.
|
|
|
|
|
thank u for the message.
so, for example, CSocket can work as both 'accept' - just call it server - and 'connect to the accept' - just call it client.
both can be on any win/nt platform.
in java, there are 2 different sockets: ServerSocket and Socket, according to ur opinion, there is no such symmetric things in c++ for win/nt?
is my understanding right?
regards
includeh10
|
|
|
|
|
There are Java-style socket libraries for C++ that implement separate Socket/ServerSocket classes. Or if my recollection is false, you can implement one yourself;)
|
|
|
|
|
I write a data server, which just simply open an ADO recordset in the server, and sends data to the client. The client will also maintain a RowList. However, I'm when a user Added a new record locally, I don't know where I should put the record in, as it has to be in the same position as the server's one, otherwise the records are not synchronized with MoveNext, MovePrevious operations.
say, in the 3 record, the user AddNew and save. I should put the newly added record in the 4th position, and in the Server's recordset, i do the same in the 3rd record, and the record will go into 4th position in the server's recordset too ???
|
|
|
|
|
i try to run a program from c++, but how to get info from io stream?
i.e. run javac.exe, it displays a lots info in command window, i want to get the info to my c++ app at run time.
if use java Runtime class, i can do it, but i want to use c++ now.
please help!
includeh10
|
|
|
|
|
|
If that's too "heavy", and onlystdout is needed, a plain call to _popen will do. Example
#include <stdio.h>
#include <stdlib.h>
void main( void )
{
char psBuffer[128];
FILE *chkdsk;
if( (chkdsk = _popen( "dir *.c /on /p", "rt" )) == NULL )
exit( 1 );
while( !feof( chkdsk ) )
{
if( fgets( psBuffer, 128, chkdsk ) != NULL )
printf( psBuffer );
}
printf( "\nProcess returned %d\n", _pclose( chkdsk ) );
}
|
|
|
|
|
good idea, thanks. i will try more once i have time.
cheers.
includeh10
|
|
|
|
|
What is the wrong ?
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
class MyMath
{
public:
friend int Sum(int v1, int v2);
};
int Sum(int v1, int v2)
{
return v1 + v2;
}
void main()
{
MyMath obj;
cout << "Result: " << obj.Sum(1, 3);
_getch();
}
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|