|
fvcker wrote: how do I use GetProcessID? I couldn't find any articles at MSDN!
The last letter is not supposed to be capital.
For more info:GetProcessId[^]
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
doesn't make a difference
|
|
|
|
|
Did you read the documentation I linked to?
I suppose not, because if you did you would have found out that you should not call ::GetProcessId() with a string as parameter, you call it providing a HANDLE to a process.
At this point it would do you much better if you explain what you're trying to do and why since this is at best pulled out of context.
You probably should enumerate the running processes, but that depends on what you're trying to do.
Have a look here[^] and here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I'm trying to find the PID from the process name.
|
|
|
|
|
fvcker wrote: I'm trying to find the PID from the process name.
Yes, I figured that out, but why?
What are you going to do with that process ID?
Have you considered the possibility that there might be more than one instance of e.g. "cmd.exe" running? Which one would be the one you're interested in? How are you supposed to know?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
|
fvcker wrote: I included...iostream...
Just out of curiosity, why would you think that would be it?
What OS are you using? Do you have the Platform SDK installed?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Im using windows xp sp2. Platform SDK?
I included iostream because I was too lazy to remove it
|
|
|
|
|
fvcker wrote: Platform SDK?
Yes.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
Good Morning!
I have some code done in C. I'm building it using Visual C++, but there are some errors like:
Error 1 error C2054: expected '(' to follow 'SHARED_FUNCTION'
Error 2 error C2085: 'le16ToHost' : not in formal parameterlist
The function is declared like this:
SHARED_FUNCTION WORD le16ToHost( BYTE * src );
There's any problem with the way i'm declaring de function? Shared Functions are different in Visual C++?
Best regards.
|
|
|
|
|
How is it defined SHARED_FUNCTION (provided it is )?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The function is provided like this:
WORD le16ToHost( BYTE * src )
{
return (src[0] ) |
(src[1] << 8 );
}
Hum... but the declaring is at .h file and the definition at .c file... Maybe a problem linking the header and the source code?
|
|
|
|
|
Actually have I asked about the 'SHARED_FUNCTION ' symbol. Where is it defined? How is it defined? Is it defined?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Here goes the definition file you've mentioned
But i don't understand why the program is giving those errors... I'm using Win32...
#ifndef __COMPILER_H
#define __COMPILER_H
//-----------------------------------------------------------------------------
//
//Windows Compiler specific section: This should be extracted to the
//SMAlib system for compiler specific definitions. But first do it here....
//
//-----------------------------------------------------------------------------
//##### Microsoft Compiler specific #####
#if defined ( _MSC_VER ) || defined ( MSVCPP )
//to reduce some define stuff...
#define USING_MICROSOFT_COMPILER
//don't ask....
#if defined(_DLL) || defined (_WINDLL)
#define __DLL__ 1
#endif
//building an DLL? => Mark functions with "export"
//building host => Mark functions with "import"
#ifdef __DLL__
#define SHARED_FUNCTION __declspec(dllexport)
#else
#define SHARED_FUNCTION __declspec(dllimport)
#endif
//disable all deprecation warnings,
#if (_MSC_VER >= 1400) // VC8+
#pragma warning(disable : 4996)
#endif
//define it for the rest....
#ifndef __WIN32__
#define __WIN32__ 1
#endif
#endif
//##### Borland C++Builder specific #####
#ifdef __BORLANDC__
//building an DLL? => Mark functions with "export"
//building host => Mark functions with "import"
#ifdef __DLL__
#define SHARED_FUNCTION __declspec(dllexport)
#else
#define SHARED_FUNCTION __declspec(dllimport)
#endif
//for precompield head with borland compilers...stop caching here...
#pragma hdrstop
#endif
//##### GNU C compiler specific Windows #####
#ifdef __GNUC__
#ifdef _WIN32
//__cdecl or winapi
#define SHARED_FUNCTION __cdecl
#else
/* U*nix: Linux/NetBSD/SOLARIS/... */
#define SHARED_FUNCTION
#endif
#endif
#endif /*__COMPILER_H*/
Best Regards.
|
|
|
|
|
Please compile it with the /E option to see the expanded value of 'SHARED_FUNCTION '.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks! I already detect the problem. It was the compiler selection. The program wasn't doing it.
Best regards.
|
|
|
|
|
hi all....
I Need 2 Store the EMPLOYEE INFO of a COMPANY....
im not allowed to use DATABASE...
what else can i use?
I Can Use FILES....
Other than Files What all Can I Use...
Ive To Code In VC++ MFC
|
|
|
|
|
anna mathew wrote: Other than Files What all Can I Use...
PAPER.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
in INI file i can store data in a proper method like in database...
is there something else...i mean any other file...
that can store data in a PARTICULAR FORMAT?
|
|
|
|
|
There are a lot of options, depending on many factors.
You may for instance use a XML file.
If you need to be compact (XML is verbose) you may choose a (custom) binary file (if you're using MFC , have a look at Serialization in MFC [^] topic.
SQLite [^] being serverless, maybe another option.
...
Bottom line: there are a lot of options, you've to be more detailed in your requirements to end up with the proper solution.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank you 4 your reply...
XML is a good choice...but little complicated with MFC...
Heard INI files is a good choice...
Can u tell me how to do it?
I mean HOW TO WRITE EMPLOYEE INFO OF A COMPANY
to INI file.....
and read it back
|
|
|
|
|
anna mathew wrote: XML is a good choice...but little complicated with MFC...
You may use MSXML or other libraries, there are lot of them around.
anna mathew wrote: Heard INI files is a good choice...
Serialization is far better. Anyway, if you want to use INI files, then you have use the functions (GetPrivateProfileInt ,...) listed at the bottom of this page [^].
Check out also this article [^].
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
If you know STL, vector would handle your needs.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Thank You so much....
That Was a GREAT Answer.....
|
|
|
|