|
I’m about to move from Visual Studio 6.0 to Visual Studio .NET. I’ve heard that it might be problems when I should copy resources (e.g. a dialog) from one project to another. Any known issues?
_____________________________
...and justice for all
APe
|
|
|
|
|
I am trying to update the text display box when a button is pressed.
If the user presses the button "1" once, then "1" appears on the display. If he presses it again, "11" . Max display length is 10.
Apart from the counter(if n=x, print "1" x-times), is there an efficient way to do this?
-hithesh
|
|
|
|
|
Are you making a calculator ?
Maybe a solution is to store the number in an long integer value. So, initialize it with zero. Each time the button is pressed, take the current number, multiply it by 10 and add the current value (so for example, you already have 123 and the user presses 4, that will give you 1230 + 4 = 1234). And then, each time a button is pressed, you print the result (convert the long int into a string and display it). Also, first you will need to check if the number doesn't contain more (or equal) than 9 digits. What you can do is check like that:
if (Number*10>999999999)<br />
return;
Hope this helps
|
|
|
|
|
Hey, thanks for the reply.
Yes, I am building a calculator. how did u know?
The solution you gave is just what i wanted.
But how do I convert long into string and vice cersa?
thanx
-hithesh
-hithesh
|
|
|
|
|
hithesh wrote:
Yes, I am building a calculator. how did u know?
Hum, in fact this was just a guess but what you were asking for is typical used in a calculator
hithesh wrote:
But how do I convert long into string and vice cersa?
Use the ltoa and atol functions
A little tip also: instead of having one handler function for each number button, you can also use the ON_MESSAGE_RANGE macro. This will give you something like (I don't remeber the exact syntax):
OnNumber(int nButtonId)<br />
{<br />
int Value = nButtonId - IDC_BUTTON0;<br />
<br />
}
|
|
|
|
|
how to retrieve char by char from a string and then append using vc++ code..
plz help me anybody????
|
|
|
|
|
For retrieving char by char:
char* szString = "Test":<br />
char c;<br />
for (int i=0;i<strlen(szString);i++)<br />
{<br />
c = szString[i];<br />
....<br />
}
And what do you mean by 'append' ?? Append to what ? To another string ? If yes, first you must be sure that the other string is large enough (to avoid buffer overflow) and then you can use the same mechanism.
|
|
|
|
|
Hello All,
does anyone know how I can run a MFC Executable as a Windows-service?
It is a program that periodically checks for a file, an if found processes it and writes results to another file, so it has no user interface.
Thanks,
Ronald Wilmink.
|
|
|
|
|
Here is a wrapper application to start you app as service. http://www.codeproject.com/system/xyntservice.asp[^]
But if you want your exe to be registered as service by itself, then you will have to look into samples here in codeproject on how to write a service, and then modify your MFC source code accordingly. Believe its not very difficult.
suhredayan There is no spoon.
|
|
|
|
|
|
Hello All,
does anyone know how I can run a MFC Executable as a Windows-service?
It is a program that periodically checks for a file, and if found processes it and writes results to another file, so it has no user interface.
Thanks,
Ronald Wilmink.
|
|
|
|
|
|
rwilmink wrote:
It is a program that periodically checks for a file...
It would be better to let the OS notify you that the file has been created rather than waste CPU cycles checking for it. See ReadDirectoryChangesW() and FindFirstChangeNotification() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello Everyone,
Can someone please tell a way to force an MDI child / MDI Doc Template to be always on top of other children.
Many Thanks
|
|
|
|
|
Hi all,
I want to load the watermark and logo images run-time for my wizard.
I tried to use this code, but it does not seem to work:
HBITMAP hBmp = ::LoadImage(...);
if (hBmp)<br />
{<br />
m_psh.hbmpWatermark = hBmp;<br />
m_psh.dwFlags |= PSH_USEHBMPWATERMARK;
}
Can someone help me with this one?
Geert
http://geert.yoki.org
|
|
|
|
|
I already fixed the problem.
I thought I must use PSH_USEHBMPWATERMARK or PSH_WATERMARK. But if you want to use a HBITMAP watermark, you have to use both.
Geert
http://geert.yoki.org
|
|
|
|
|
can somebody tell me about how to enter only 6 array ( array[6] ) but will display symmetric matrix in array format ??
is something like the following :
deviced a method for storing a symmetric matric with a view to saving a storage space.
thank you
|
|
|
|
|
The way you display your array is up to you, but there's no intrinsic way to make a single dimension array equal a matrix. You need to define the rules to do that.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Please reply via CP and not private email if you want a reply.
If you want an answer on this:
khyap wrote:
deviced a method for storing a symmetric matric with a view to saving a storage space.
you'll need to translate it into English. What does 'deviced' mean ? Surely your homework question is not worded this way ? Is it 'devise a method' ?
You'll need to do your own homework.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi there,
I tried sizing and positioning the Microsoft Word window that opens up my selected file but it doesn't seem to work. What am I doing wrong? Please see code below:
STARTUPINFO stStartUpInfo;
PROCESS_INFORMATION *pProcessInfo = new PROCESS_INFORMATION;
memset(&stStartUpInfo, 0, sizeof(STARTUPINFO));
stStartUpInfo.cb = sizeof(STARTUPINFO);
stStartUpInfo.dwFlags = STARTF_USESHOWWINDOW;
stStartUpInfo.dwFlags = STARTF_USESIZE;
stStartUpInfo.dwFlags = STARTF_USEPOSITION;
stStartUpInfo.wShowWindow = SW_SHOWDEFAULT;
stStartUpInfo.dwXSize = 200;
stStartUpInfo.dwYSize = 200;
stStartUpInfo.dwX = 200;
stStartUpInfo.dwY = 200;
CreateProcess(NULL, command_line, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS,
NULL, NULL, &stStartUpInfo, pProcessInfo);
|
|
|
|
|
elephantstar wrote:
stStartUpInfo.dwFlags = STARTF_USESHOWWINDOW;
stStartUpInfo.dwFlags = STARTF_USESIZE;
stStartUpInfo.dwFlags = STARTF_USEPOSITION;
You're overwriting the dwFlags value in each statement. You need to OR the values:
stStartupInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESIZE | STARTF_USEPOSITION;
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
In addtion to the error pointed by Ryan Binns. I feel still there are other problems to accomplish the required behaviour. ie, The values in the STARTUPINFO structure are used only if the spawned application creates its window with CW_USEDEFAULT Style. In the case of word, it takes the startup position from the following registry key.HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Word\Data AFAMK.
suhredayan There is no spoon.
|
|
|
|
|
What do you mean if the spawned applicaton creates its window with CW_USEDEFAULT style? Do I need to call CreateWindow() and then CreateProcess? I'm a bit confused.
|
|
|
|
|
elephantstar wrote:
What do you mean if the spawned applicaton creates its window with CW_USEDEFAULT style?
If the process that you create via CreateProcess() is a GUI application, it will eventually call CreateWindow() to create its main window. Read about CreateProcess() here. Notice that several of the parameters are ignored unless the new process calls CreateWindow() with CW_USEDEFAULT .
elephantstar wrote:
Do I need to call CreateWindow() and then CreateProcess?
No, the call to CreateProcess() is fine.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
CreateProcess() is being called from a child window class (CMDIChildWnd) if that changes things. I see what you're saying in that CreateProcess() calls CreateWindow but how to I access CreateWindow to make the change?
|
|
|
|