Page 1 of 1

Using InitializeMagick without *argv in C++

Posted: 2007-08-31T05:30:26-07:00
by Citizen Erased
First off, I'm a bit new to this so pardon my ignorance. I'm using a template program I constructed from following a book that is based around windows. There is no

Code: Select all

int main( int /*argc*/, char ** argv)
function but rather a winmain function:

Code: Select all

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
. With this in mind, what do I pass to InitializeMagick instead of *argv? Thanks.

Re: Using InitializeMagick without *argv in C++

Posted: 2007-08-31T06:25:25-07:00
by magick
If argv is not available use

Code: Select all

InitializeMagick("");

Re: Using InitializeMagick without *argv in C++

Posted: 2010-12-29T20:47:02-07:00
by anotherprogrammer123
Or, you can use _getcwd: http://msdn.microsoft.com/en-us/library ... 80%29.aspx
Maybe ImageMagick uses this internally?

Re: Using InitializeMagick without *argv in C++

Posted: 2010-12-30T08:43:42-07:00
by el_supremo
FYI: If you do want to pass an argument to InitializeMagick, the "cmdline" string passed as an argument to WinMain is the unprocessed argument(s) passed to the program.
If you start the program by double clicking on it, the argument will be a null string "". If you start the program on the command line like this:

Code: Select all

testprog whatever        you like
The cmdline argument will be the string

Code: Select all

"whatever        you like"
including the spaces but excluding the command name itself.

Pete