|
|
my requirement is that i have to set static ip address in command line and the netsh command i have to call from my c++ program.van any body suggest how to accomplish this?
|
|
|
|
|
an89 wrote: parsing result from command line arguments in c++
See Here[^].
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
its not goin to help.if anybody can provide some sample code,then that would be helpfull.My requirement is that what ever i get at commandline,i should be able to get it back in my code
|
|
|
|
|
an89 wrote: its not goin to help
and why isn't it going to help? Any wise guesses
You asked about reading the command line arguments and parsing them. The logic does the same
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
see,in the tutorial that u mentioned we have to give arguments at commandline,right?and in the program we are extracting those arguments.
But in my application,through my code i'll give a command,and i need the output of the command when the command executes successfully.I hope I made myself clearer this time.
|
|
|
|
|
humf.
You can use the argument to pass as a parameter to ShellExecute or CreateProcess.
how do you give the command and to whom...
an89 wrote: I hope I made myself clearer this time.
Not for me, it's still a blurr picture
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
an89 wrote: suggest how to accomplish this?
By searching for argc and argv .
"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
|
|
|
|
|
Hello,
need help to set a images in CListCtrl(CSortListCtrl here from codeproject) when is used in virtual mode,
have any one idea how to solve this??
regards
termal
|
|
|
|
|
termal wrote: CSortListCtrl here from codeproject
Better you ask in the article forum at the bottom of the article page! Anyway as a pointer take a look at LVN_GETDISPINFO and I_IMAGECALLBACK .
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hello,
thanks for "LVN_GETDISPINFO and I_IMAGECALLBACK"!
regards
termal
|
|
|
|
|
there is an application that keep nagging me...every time it closes, it will open my internet browser...i want to make an app with visual c++ so i can stop it opening my internet browser...can i use a hook to stop it...can anyone help me please...
thx
|
|
|
|
|
Writing a hook isn't very easy. Why don't you just check every 100 milliseconds if Internet Explorer opened after this app closed and then close it.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
ya nice idea...but do you have any idea (link) or something wherei can learn about hook in windows...??
|
|
|
|
|
why do you insist on doing it the hard way? polling every 100 ms IMO won't be any slower from your point of view.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
The project is an EXE application. But the linker always creates a *.lib file, as if it was a dll project.
--------------------Configuration: MyProject - Win32 Release--------------------
Linking...
Creating library Release\MyProject.lib and object Release\MyProject.exp
MyProject.exe - 0 error(s), 0 warning(s)
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
sashoalm wrote: But the linker always creates a *.lib file, as if it was a dll project.
You are exporting some symbols from the exe, that's the reason IMO.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
It seems that you are right, i dumped the lib and exp files, and they all show functions from the CxImage library (which is included in the project). How do I fix it?
Here's an excerpt of the dump of MyProject.exp - it's too long to post all of it:
01A1h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImageJPG::CxExifInfo::CxExifInfo(struct CxImageJPG::tag_ExifInfo *)
01A2h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxFile::CxFile(class CxFile const &)
01A3h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxFile::CxFile(void)
01A4h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxIOFile::CxIOFile(class CxIOFile const &)
01A5h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxIOFile::CxIOFile(struct _iobuf *)
01A6h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImage::CxImage(class CxImage const &,bool,bool,bool)
01A7h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImage::CxImage(unsigned long)
01A8h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImage::CxImage(unsigned long,unsigned long,unsigned long,unsigned long)
01A9h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImage::CxImage(unsigned char *,unsigned long,unsigned long)
01AAh UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImage::CxImage(struct _iobuf *,unsigned long)
01ABh UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImage::CxImage(class CxFile *,unsigned long)
01ACh UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImage::CxImage(char const *,unsigned long)
01ADh UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImageGIF::CxImageGIF(class CxImageGIF const &)
01AEh UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImageGIF::CxImageGIF(void)
01AFh UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImageJPG::CxImageJPG(class CxImageJPG const &)
01B0h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImageJPG::CxImageJPG(void)
01B1h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImageTIF::CxImageTIF(class CxImageTIF const &)
01B2h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxImageTIF::CxImageTIF(void)
01B3h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxMemFile::CxMemFile(class CxMemFile const &)
01B4h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxMemFile::CxMemFile(unsigned char *,unsigned long)
01B5h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxPoint2::CxPoint2(class CxPoint2 const &)
01B6h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxPoint2::CxPoint2(float,float)
01B7h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxPoint2::CxPoint2(void)
01B8h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxRect2::CxRect2(class CxRect2 const &)
01B9h UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxRect2::CxRect2(float,float,float,float)
01BAh UNDEF 00000000h 0000h EXTERNAL public: __thiscall CxRect2::CxRect2(void)
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I guess this class must be imported instead of exported since IMO it's an external library which you are using. You might have defined some macros which you shouldn't.
Let me guess!
#if defined _EXPORT_FROM_DLL
#define EXPORT_IMPORT __declspec(dllexport)
#else
#define EXPORT_IMPORT __declspec(dllimport)
#endif
class EXPORT_IMPORT CxImage
{
}
So somewhere _EXPORT_FROM_DLL is getting defined which forces an export.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
I found very similar constructs in one of the headers in the CxImage library. I have _AFXDLL defined because the project uses MFC as a shared dll. So should I just remove the condition?
#if defined(_AFXDLL)||defined(_USRDLL)
#define DLL_EXP __declspec(dllexport)
#elif defined(_MSC_VER)&&(_MSC_VER<1200)
#define DLL_EXP __declspec(dllimport)
#else
#define DLL_EXP
#endif
...
class DLL_EXP CxFile
{
...
};
...
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
sashoalm wrote: #elif defined(_MSC_VER)&&(_MSC_VER<1200)
I am not sure of this line since VC6 has _MSC_VER set to 1200 so will this code ever expand to __declspec(dllimport)?
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
I don't think so either, but I defined it explicitly to see what happens
#define DLL_EXP __declspec(dllimport)
, and there are several errors and warnings:
Linking...
Creating library Debug\MyProject.lib and object Debug\MyProject.exp
LINK : warning LNK4049: locally defined symbol ""public: void * __thiscall CxImage::GetDIB(void)const " (?GetDIB@CxImage@@QBEPAXXZ)" imported
LINK : warning LNK4049: locally defined symbol ""public: void __thiscall CxImage::SetJpegQuality(unsigned char)" (?SetJpegQuality@CxImage@@QAEXE@Z)" imported
...
error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall CxImage::Encode(class CxFile *,unsigned long)" (__imp_?Encode@CxImage@@QAE_NPAVCxFile@@K@Z)
error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall CxImage::Encode(class CxFile *,unsigned long)" (__imp_?Encode@CxImage@@QAE_NPAVCxFile@@K@Z)
...
Debug\MyProject.exe : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.
MyProject.exe - 8 error(s), 25 warning(s)
I also tried with defining it to nothing:
#define DLL_EXP
and it still creates an exp and lib files, with the same export symbols. I really don't get it
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
By the way how are you using CxImage library. Have you included the entire source code into your project or are you dynamically/statically linking to it as a dll/lib?
I am asking these because the linker says it's a local symbol.
And this is what MSDN has to say on this warning...
The symbol was both exported from and imported to the program.<br />
<br />
This warning is generated by the linker when you declare a symbol by using the __declspec(dllexport) storage-class attribute in one object file and reference it by using the __declspec(dllimport) attribute in another.<br />
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
It's a statically linked library - no dll or cpp files, only headers and lib files.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|