|
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?
|
|
|
|
|
elephantstar wrote:
I see what you're saying in that CreateProcess() calls CreateWindow...
CreateProcess() does not call CreateWindow() . CreateWindow() is called by the newly created process.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
elephantstar wrote:
PROCESS_INFORMATION *pProcessInfo = new PROCESS_INFORMATION;
Why allocate this on the heap? It's a needless call to the memory manager, not to mention there is no matching delete . A simple stack-based variable will suffice.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
I have made a List Ctrl with column drag and drop feature, but I just want my first column can not be drag and drop! Just like iTunes( the first column:"Song name" can not be drag or drop),but I can not find useful message to do this. Could any one give me some suggestion? Thanks a lot!
pls, any comment is welcome
|
|
|
|
|
vectors and arrays can store linear sequences of numbers. it is often the case taht we want to store collection of number that have a two dimensional layout. such as an arrangement of number consisting of rows and colums is called a multi-dimensional array
in the following example write code that fill a vectore v with the values
1 2 3 4 5 6 7 8 9 10
0 2 4 6 8 10 12 14 16 18 20
1 4 9 16 25 36 49 64 81 100
0 0 0 0 0 0 0 0 0 0
1 4 9 16 9 7 4 9 11
another question
i also don't know how to design a class student.
requirement:
student has several attributes, name and birthday, make a vector
vector<student>friends:
program that reads a set of name and birthdays (type them in)
the output of printing out all friends whose birthday falls in the current month.
please help me !!
thanks a lot !!!!
jemy
|
|
|
|
|
To do this, create a vector of vectors, then you end up with a jagged array.
jemy0130 wrote:
another question
i also don't know how to design a class student.
requirement:
student has several attributes, name and birthday, make a vector
vectorfriends:
program that reads a set of name and birthdays (type them in)
the output of printing out all friends whose birthday falls in the current month.
please help me !!
thanks a lot !!!!
Stop and think about what is being asked - it's pretty straightforward. It's obvious this is your homework. You really should stop and think about your homework, give it a go, then ask *specific* questions when you get stuck. We're not here to do your homework for you. The first part was an example of a specific question (how do I use a vector to make a 2D array), and we're more than happy to help with stuff like that.
I'm pleased to see someone is taking classes that use the STL instead of teaching C with classes.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I need read content of wave files as data for further mathematical analyses. How do I exctract pure data?
ytvsoftware
|
|
|
|