Using InitializeMagick without *argv in C++

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Citizen Erased

Using InitializeMagick without *argv in C++

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Using InitializeMagick without *argv in C++

Post by magick »

If argv is not available use

Code: Select all

InitializeMagick("");
anotherprogrammer123
Posts: 36
Joined: 2010-02-21T18:02:40-07:00
Authentication code: 8675308

Re: Using InitializeMagick without *argv in C++

Post by anotherprogrammer123 »

Or, you can use _getcwd: http://msdn.microsoft.com/en-us/library ... 80%29.aspx
Maybe ImageMagick uses this internally?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Using InitializeMagick without *argv in C++

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Post Reply