monoceres Posted June 22, 2008 Posted June 22, 2008 Sorry for being needy this last couple of days but I'm just running into problem after problem. Today I tried to make a dll that would just wrap another function, but it just keeps on crashing Here's my c++ code: #include <windows.h> extern "C" __declspec(dllexport) void _SetPixel(HDC dc,int x, int y, unsigned int color) { SetPixel(dc,x,y,color); } And here's my autoit code: #include <GDIPlus.au3> #include <Winapi.au3> $hwnd=GUICreate("hello",300,200) GUISetSTate() _GDIPlus_Startup() $graphics=_GDIPlus_GraphicsCreateFromHWND($hwnd) _GDIPlus_GraphicsClear($graphics,0xFFFFFFFF) $dc=_GDIPlus_GraphicsGetDC($graphics) DllCall("GDIplusplus.dll","none","_SetPixel","ptr",$dc,"int",10,"int",10,"dword",0xFF0000) Do $msg=GUIGetMsg() Until $msg=-3 _GDIPlus_GraphicsReleaseDC($graphics,$dc) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() I can see that the pixel gets painted and everything but right after that it's just a big crash! Ps. I do know that I could call the Setpixel function like this: DllCall("gdi32.dll", "int", "SetPixel", "ptr", $dc, "int", 10, "int", 10, "dword",0xFF0000) but I'm after the principle. Broken link? PM me and I'll send you the file!
Siao Posted June 22, 2008 Posted June 22, 2008 See the Remarks of DllCall reference in helpfile. Particularly the paragraph about calling conventions. "be smart, drink your wine"
monoceres Posted June 22, 2008 Author Posted June 22, 2008 See the Remarks of DllCall reference in helpfile. Particularly the paragraph about calling conventions.Thanks, I got it working How do I make a dll that uses stdcall instead?__stdcall gives me lots of errors in Visual studio 2008.. Broken link? PM me and I'll send you the file!
Moderators SmOke_N Posted June 22, 2008 Moderators Posted June 22, 2008 Thanks, I got it working How do I make a dll that uses stdcall instead?__stdcall gives me lots of errors in Visual studio 2008..Why would you bother with stdcall? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
monoceres Posted June 22, 2008 Author Posted June 22, 2008 Why would you bother with stdcall? I really don't know, but since i never even saw the "Function DllCallint:cdecl" syntax before I figured that stdcall was some sort of standard that would be good to follow or something. But I really don't know that much about this so I guess I will do fine with cdecl. Broken link? PM me and I'll send you the file!
Moderators SmOke_N Posted June 22, 2008 Moderators Posted June 22, 2008 I really don't know, but since i never even saw the "Function DllCallint:cdecl" syntax before I figured that stdcall was some sort of standard that would be good to follow or something.But I really don't know that much about this so I guess I will do fine with cdecl. I write all mine in cdecl. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
ptrex Posted June 23, 2008 Posted June 23, 2008 @monoceresIn case you're interested to know the differeces.Calling conventions on the x86 platformRegards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now