|
Wise men, off course! Are you ?
Just kidding!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Mostly I'm
![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Lookup EnumProcesses() and/or CreateToolhelp32Snapshot()
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Thanks for not joking with me.
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
With EnumProcesses you can see it
|
|
|
|
|
Thanks for not joking with me.
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
When you launch the program you'll probably be using CreateProcess or ShellExecuteEx . Either way you can get a HANDLE to the newly created process: in the PROCESS_INFORMATION structure if CreateProcess is used or the hProcess member of the SHELLEXECUTEINFO struct if ShellExecuteEx is used. Use the WaitForSingleObject API passing this HANDLE value.
Steve
|
|
|
|
|
Thanks! I'll try it.
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Hi all. Im trying something new. Something yesterday gave me an idea that i could use it with more than one source file. So i created 2 source files and 1 header file to do all the including and bridging communication between sources.
Here's what i have so far.
Source 1
<br />
#include "include.h"<br />
<br />
int main(){<br />
const SIZE = 100;<br />
char msg[SIZE];<br />
printf("Enter a file you'd like to read: ");<br />
cin.getline(msg,SIZE);<br />
if(!msg){<br />
printf("File %s doesnt exist.\n",msg);<br />
}<br />
else{<br />
printf("Reading file %s",msg);<br />
readfile();<br />
}<br />
return 0;<br />
}<br />
Source 2
<br />
#include "include.h"<br />
<br />
void readfile(void){<br />
char buffer[100]={'\0'};<br />
ifstream file("test.txt");<br />
while(file.getline(buffer, 100)){<br />
Sleep(3000);<br />
printf("%s\n",buffer);<br />
}<br />
file.close();<br />
cin.get();<br />
} <br />
Source 1 is to check what type of file you want to read. And determines if its in the area or not. Then source 2 actually does the reading once source1 gives it the O.K. - But im getting errors like mad.
<br />
: error C2513: 'const struct tagSIZE' : no variable declared before '='<br />
: error C2275: 'SIZE' : illegal use of this type as an expression<br />
: see declaration of 'SIZE'<br />
: error C2057: expected constant expression<br />
: error C2466: cannot allocate an array of constant size <br />
: error C2133: 'msg' : unknown size<br />
: error C2275: 'SIZE' : illegal use of this type as an expression<br />
: see declaration of 'SIZE'<br />
If i compile them individually they work fine. But together they seem not to like each other. How do i fix this? Thanx in advance.
|
|
|
|
|
SIZE is already defined in the Windows headers (which you can see from the error message saying "struct tagSIZE" and "illegal use of this type"). Change it to something else.
|
|
|
|
|
dellthinker wrote: error C2513: 'const struct tagSIZE' : no variable declared before '='
As said earlier its predefined, so you need to initialized it accordingly.And you have missed there variable name/data type.
Declare it like this,
const int SIZE= 100;
char msg[SIZE];
|
|
|
|
|
What is the function that will allow me to execute a program in my c++ program?
|
|
|
|
|
See for CreateProcess() or ShellExecute() documentation on MSDN.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
I vote for CreateProcess() . You get a lot more info about the process you create when you use that function than with any of the other methods (ShellExecute or WinExec ).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I'm looking for an example how to disable standard menue items (especially the "Save as.."-method in MS-Office applications like Word and Excel) that have been started by a MFC program using the CreateDispatch method. I want to force the user to save the file with the same name and path that I used to open the file when starting the application.
Peter Fritze
|
|
|
|
|
Peter Fritze wrote: I want to force the user to save the file with the same name and path that I used to open the file when starting the application
You have an interesting problem here,
Thinking about it there are a couple of ways to accomplish what you’re looking for, but neither of them are direct or at least the little bit of searching I did revealed anything direct.
First:
Spy, the handle to that menu item and send it a disable message. I don’t know how well that would work or not.
Second:
Catch the message from DocumentBeforeSave, see examples here.
How to catch Word application events by using Visual C++[^]
Automation and Eventing with Word[^]
DocumentBeforeSave Event[^]
Hope this helps, or at least gets yea started.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
how to provide VPN connection between client and server?
|
|
|
|
|
|
Turning from visual c++ (version6) to visual studio c++ 2005 recently i've got errors when compiling this code:
#include "mave.hpp"
template <typename T> class matrix : virtual public mave<T>
{
public:
enum enLineSolver { GAUSS, HOUSEHOLDER, GIVENS, SHOLESKY};
protected:
static enLineSolver lineSolver;
};
// Initialization of lineSolver:
template <typename T> matrix<T>::enLineSolver matrix<T>::lineSolver = matrix<T>::GAUSS;
/* With Visual C++ (Version 6) above line is translated correctly without any
message. With Visual Studio 2005 compilation fails with these messages:
warning C4346: 'matrix<T>::enLineSolver' : dependent name is not a type
e:\007-chera\006-mavex3\matrix.hpp 274
error C2143: syntax error : missing ';' before 'matrix<T>::lineSolver'
e:\007-chera\006-mavex3\matrix.hpp 274
error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
e:\007-chera\006-mavex3\matrix.hpp 274
I've tried several changes to resolve this error without success. template
is necessary because of indentifier T. matrix<T>::enLineSolver cannot
be replaced by simple int for another error then appears (different type).
*/
Any idea what's wrong?
-- modified at 9:54 Saturday 27th January, 2007
|
|
|
|
|
From the help on C4346:The typename keyword is required if a dependent name is to be treated as a type. You're using the dependent type matrix<T>::enLineSolver (meaning, it depends on the template parameter T ) so you have to add typename before it:
template <typename T>
typename matrix<T>::enLineSolver matrix<T>::lineSolver = matrix<T>::GAUSS;
|
|
|
|
|
Hi everybody.
I wanna write an application which has a database created using SQL-Server2000.
In this app I need to have a beautiful graphical user interface and on the other hand have to be able to work with the data tables in an mfc application that is created with vc 2003.(not .net)
what do you suggest?
i think a web service would help if so, can i write it with .net2.0 using c# and asp.net and use the web service with mfc 1.1?
please help me!!!!!!
Sepehr
|
|
|
|
|
How do you convert a array of bitmap bits to a HBITMAP?
I cannot seem to figure it out.
|
|
|
|
|
|