GDI+
-
hi. i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays. i want to use GDI+ classes but there is a runtime error. my program :
#include "stdafx.h"
#include ;
#include ;
using namespace Gdiplus;
int main()
{
Bitmap *bmp;
bmp = new Bitmap(L"my image path");
unsigned int w = bmp->GetWidth(); // the error occurs in this line// my process //... return 0;
}
the error : Unhandled exception at 0x00411761 in GdiPlusTest.exe: 0xC0000005: Access violation reading location 0x00000004. any help? thanks.
-
hi. i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays. i want to use GDI+ classes but there is a runtime error. my program :
#include "stdafx.h"
#include ;
#include ;
using namespace Gdiplus;
int main()
{
Bitmap *bmp;
bmp = new Bitmap(L"my image path");
unsigned int w = bmp->GetWidth(); // the error occurs in this line// my process //... return 0;
}
the error : Unhandled exception at 0x00411761 in GdiPlusTest.exe: 0xC0000005: Access violation reading location 0x00000004. any help? thanks.
__erfan__ wrote:
i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays.
Hey, you're in the un-managed world here. :-D Probably the bitmap object it is incorrectly built because you've not initialized, as required, the
GDI+
library (MSDN [^]):You must call GdiplusStartup before you create any GDI+ objects, and you must delete all of your GDI+ objects (or have them go out of scope) before you call GdiplusShutdown.
:)
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] -
hi. i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays. i want to use GDI+ classes but there is a runtime error. my program :
#include "stdafx.h"
#include ;
#include ;
using namespace Gdiplus;
int main()
{
Bitmap *bmp;
bmp = new Bitmap(L"my image path");
unsigned int w = bmp->GetWidth(); // the error occurs in this line// my process //... return 0;
}
the error : Unhandled exception at 0x00411761 in GdiPlusTest.exe: 0xC0000005: Access violation reading location 0x00000004. any help? thanks.
__erfan__ wrote:
Unhandled exception at 0x00411761 in GdiPlusTest.exe: 0xC0000005: Access violation reading location
You have to initialize GDI+ before you make any GDI+ calls. check GdiplusStartup()[^] function
nave [My Articles] [My Blog]
-
hi. i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays. i want to use GDI+ classes but there is a runtime error. my program :
#include "stdafx.h"
#include ;
#include ;
using namespace Gdiplus;
int main()
{
Bitmap *bmp;
bmp = new Bitmap(L"my image path");
unsigned int w = bmp->GetWidth(); // the error occurs in this line// my process //... return 0;
}
the error : Unhandled exception at 0x00411761 in GdiPlusTest.exe: 0xC0000005: Access violation reading location 0x00000004. any help? thanks.
-
__erfan__ wrote:
i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays.
Hey, you're in the un-managed world here. :-D Probably the bitmap object it is incorrectly built because you've not initialized, as required, the
GDI+
library (MSDN [^]):You must call GdiplusStartup before you create any GDI+ objects, and you must delete all of your GDI+ objects (or have them go out of scope) before you call GdiplusShutdown.
:)
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] -
ops... A photo finish. and you won :)
nave [My Articles] [My Blog]
-
I'm pretty sure he has borrowed some of Rajesh's monkeys. He only slept 4 hours last night. He is training them to play chess. :laugh: Best Wishes, -David Delaune
haaa...He took drug. see 'espresso'[^]
nave [My Articles] [My Blog]
-
__erfan__ wrote:
i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays.
Hey, you're in the un-managed world here. :-D Probably the bitmap object it is incorrectly built because you've not initialized, as required, the
GDI+
library (MSDN [^]):You must call GdiplusStartup before you create any GDI+ objects, and you must delete all of your GDI+ objects (or have them go out of scope) before you call GdiplusShutdown.
:)
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] -
hi. i want to write an image processing program and i don't need to preview the image so i decided to use win32 console application to avoid any unwanted delays. i want to use GDI+ classes but there is a runtime error. my program :
#include "stdafx.h"
#include ;
#include ;
using namespace Gdiplus;
int main()
{
Bitmap *bmp;
bmp = new Bitmap(L"my image path");
unsigned int w = bmp->GetWidth(); // the error occurs in this line// my process //... return 0;
}
the error : Unhandled exception at 0x00411761 in GdiPlusTest.exe: 0xC0000005: Access violation reading location 0x00000004. any help? thanks.
-
I'm pretty sure he has borrowed some of Rajesh's monkeys. He only slept 4 hours last night. He is training them to play chess. :laugh: Best Wishes, -David Delaune
Randor wrote:
I'm pretty sure he has borrowed some of Rajesh's monkeys
Randor wrote:
He is training them to play chess.
I actually was persuading one of them (the most appealing female of the group) to have some ... (well I suppose it's not sister kid safe) :-D
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] -
Looks like the missing initialization didn't pass unnoticed... :-D
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] -
Hi, Please mark the correct answers(s) that helped you by clicking "Good Answer". I've done it for you now.
“Follow your bliss.” – Joseph Campbell