|
If I understand u correctly u want to do things before showing the main window.
To do this u don't have to mangle with main(), WinMain() nor constructing MyApp yourself. All u have to do is put some code in MyApp::InitInstance() before the window creation/show.
Just to comment few other things:
First, the way u try to initialize MyApp is invalid syntax.
If u follow the MFC App Wizard, MyApp is created on the "global stack" - the standard library initializes it before calling main().
Second, u can track down MFC's WinMain (just look at the call stack) and alter it. But your code will not run there unless u compile MFC itself.
HTH
|
|
|
|
|
Thank you for your replies.
Yes, what I am trying to do is to do things before showing the main window, or not to show it at all. My programm enumerates NFC boards, and if it detects more than 1, a window should pop up and ask user to select one of them. If it only finds one board, the app should select that board and the window shouldnt pop up.
I tried to set the visible property to false, but nothing happened!?!? The only thing I can imagine is that the release build wont show the window, I dont know and didnt try it.
Thanks
|
|
|
|
|
Hi everybody,
I'am using the DrawText function to draw this text "p&m":
DrawText(_T("p&m"),LPRECT(CRect(0,0,100,100)),DT_LEFT);
but my problem is that the text on the screen appear with the 'm' underlined.
could someone help me!!
thanks.
|
|
|
|
|
Either double the & character, or use the DT_NOPREFIX flag (i.e. specify DT_LEFT | DT_NOPREFIX ).
This feature is intended for use by various Windows functions to indicate accelerator keys for activating controls. Windows 2000 and higher, by default, hide the accelerator key indicators until the Alt key is pressed, so you may not have seen this behaviour.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
What you are experiencing is windows' method of representing shortcuts. So what you have to do in order to get the text "p&m" is to use the folowing ampersand escape sequence:
DrawText(_T("p&&m"), LPRECT(CRect(0,0,100,100)), DT_LEFT);
For more details look up escape characters on msdn
|
|
|
|
|
DrawText(_T("Thank you Mike && mikanu for your help"), LPRECT(CRect(0,0,100,100)), DT_LEFT | DT_NOPREFIX)
|
|
|
|
|
In Visual Studio 6, is it possible to enable breakpoints only for a certain thread? It is little annoying when the debugging context suddenly changes to another thread.
If it is not possible in Visual Studio 6, is it possible atleast in WinDbg?
thanks!
|
|
|
|
|
You can put conditions on breakpoints. If you have a variable that represents the active thread, you could use that.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I attempted to use WMF SDK, but ran into link error.
DRMShow.cpp
Generating Code...
Linking...
WMStubDRM_38503.lib(so3.obj) : error LNK2001: unresolved external symbol __ftol2
WMStubDRM_38503.lib(rc4safe.obj) : error LNK2001: unresolved external symbol __SEH_epilog
WMStubDRM_38503.lib(cpu.obj) : error LNK2001: unresolved external symbol __SEH_epilog
WMStubDRM_38503.lib(rc4safe.obj) : error LNK2001: unresolved external symbol __SEH_prolog
WMStubDRM_38503.lib(cpu.obj) : error LNK2001: unresolved external symbol __SEH_prolog
Debug/DRMShow.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
Yong
|
|
|
|
|
yongwpi wrote: WMStubDRM_38503.lib(rc4safe.obj) : error LNK2001: unresolved external symbol __SEH_epilog
WMStubDRM_38503.lib(cpu.obj) : error LNK2001: unresolved external symbol __SEH_epilog
WMStubDRM_38503.lib(rc4safe.obj) : error LNK2001: unresolved external symbol __SEH_prolog
WMStubDRM_38503.lib(cpu.obj) : error LNK2001: unresolved external symbol __SEH_prolog
Doesn't this require linking with sehprolg.obj ?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Are you using VC6? If so, you're SOL. MS stopped releasing VC6-compatible LIBs a couple years ago.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
many functions require parameters of type HANDLE. how to get it? take the following for instance:
CEdit *pEdit;
pEdit = new CEdit();
pEdit->Create(0,rect,this,IDC_EDIT1);
...
delete pEdit;
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
ewighell wrote: // how can I get a handle to the Edit window?
Use the GetSafeHwnd() method. However, why do you need it?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I want to send a message with the function SendMessage(), it seems that some of its parameters are of type HWND.
I want to send a BN_CLICKED message to the button m_bn1, which is of type CButton with the following code, but it seems does not work, where am I wrong?
SendMessage(BN_CLICKED,IDC_BUTTON1,(LPARAM)m_bn1.GetSafeHwnd());
Thank you very much!!!
-------------------
I am learning C++ and English
-- modified at 21:47 Tuesday 15th November, 2005
|
|
|
|
|
First, you don't need to get the HWND. You can just call pEdit->SendMessage(msg, wparam, lparam).
But, it won't work in your case. BN_CLICKED is a notification send by the button to its parent, not the other way aroiund . And it's not a BN_CLICKED message, it's a WM_COMMAND message with BN_CLICKED encoded in its WPARAM parameter (see MSDN for details).
What do you want to accomplish?
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
|
I am trying to debug a program using Visual Studio, but one of my local values in not matching what is printed using printf. Any ideas?
simaneal
|
|
|
|
|
Have you checked the format?
int %d
float %f
double %lf
....
Matteo
|
|
|
|
|
What do you mean ? You watch your variable with the debugger and it doesn't match what you printed with printf ?
Are you sure you are using the right format specification for your variable ?
Also, post the code (use the code tag just above the emoticons), this will be easier for us.
|
|
|
|
|
<br />
#include <stdlib.h><br />
#include <stdio.h><br />
#include <math.h><br />
#include <time.h><br />
#include <stddef.h><br />
#include <malloc.h><br />
<br />
#define nmax 118/* Maximum Number of pixels + 1 */<br />
#define npixels 117 /* Number of pixels in forest */<br />
#define tfactor 0.95 /* annealing temperature factor */<br />
#define xcoor 10/* maximum x coordinate */<br />
#define ycoor 117 /* maximum y coordinate */<br />
#define period 20 /* investment and management time period of interest */<br />
#define i 0.04 /* interest rate for discount factor */<br />
#define tmax 2 /*maximim number of feasible moves before stopping*/<br />
#define array_size 117<br />
<br />
<br />
<br />
int<br />
main (void)<br />
{<br />
<br />
int y;<br />
printf("starting\n");<br />
int *pix1;<br />
<br />
if ((pix1 = (int*)malloc(array_size * sizeof(pix1))) == NULL) {<br />
(void)printf("ERROR: Malloc failed");<br />
(void)exit(EXIT_FAILURE); <br />
}<br />
<br />
int *pixm1;<br />
<br />
if ((pixm1 = (int*)malloc(array_size * sizeof(pixm1))) == NULL) {<br />
(void)fprintf(stderr, "ERROR: Malloc failed");<br />
(void)exit(EXIT_FAILURE); <br />
} <br />
for(y=0; y<ycoor; ++y)<br />
{<br />
<br />
pix1[y]=1;<br />
pixm1[y]=1;<br />
printf("pix1= %d",pix1[y]);<br />
}<br />
int ymoves;<br />
for(ymoves=0; ymoves<ycoor; ymoves++)<br />
{<br />
if(pix1[ymoves==1)<br />
{pixm1[ymoves]=0;<br />
printf("pixm1= %d", pixm1[ymoves]);<br />
}<br />
else<br />
{<br />
pixm1[ymoves]=1;<br />
}}<br />
}<br />
return;<br />
<br />
The code is a mini version of the code I am having problems with. When I watch the locals pixm1[] is supposed to switch from a 1 to 0 and it does not. The printf statement output is pixm1 =0
I do not understand why they would be different and which one reflects what the program has as pixm1[]?
simaneal
|
|
|
|
|
Your code is not clear, but have you checked well this line?
if(pix1[ymoves==1)
Are you meaning
if(pixm1[ymoves]==1)
???
Try to write the code with a better format.
Matteo
|
|
|
|
|
I meant if(pix1[ymoves]==1)
I am trying to get pixm1[] to change based on what pix1[] is. The full code is on another computer and is to long to display here.
simaneal
|
|
|
|
|
I understand you.
But take in mind that at 99% is a your sintax error, so it is important to look at the real code.
I have to go home,
good luck.;)
|
|
|
|
|
simaneal wrote: if ((pix1 = (int*)malloc(array_size * sizeof(pix1))) == NULL) {
This code is incorrect if you are simply wanting room for 117 int s. Use one of the following instead:
int pix1[117];
...
int *pix1 = (int *) malloc(array_size * sizeof(int));
if (pix1 == NULL)
simaneal wrote: When I watch the locals pixm1[] is supposed to switch from a 1 to 0 and it does not.
How are you verifying this?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi,
I use Microsoft visual studio .net 2003.
When I'm in debug mode I can press F10 to execute single instructions (that are usually 5/10 disassembly instructions).
I have a problem with my software, and I need to execute disassembly instructions one by one.
Someone knows a way to change the editor setup and press F10(or something quite faster) to do this?
Thanks to all
|
|
|
|