Joel
9th July 2003 00:45 UTC
Need a system.dll push, please
:cry:
Seems that system can solve problems related to API, ok...
I understand the syntax, but I don't know how to convert
my VB 6 API format to system plugin format.
I read the example and the WEb archive, but still... :(
Also my english isn't very well... :cry:
for example:
;Example of VB 6 API declare:
Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" _
(ByVal hwnd As Long, ByVal szApp As String, ByVal szOtherStuff As _
String, ByVal hIcon As Long) As Long
How do I convert it in system syntax...
Declare Function GetUserDefaultLangID Lib "kernel32" _
Alias "GetUserDefaultLangID" () As Integer
How?
:cry:
kichik
9th July 2003 12:38 UTC
It's usually better to get the MSDN page on the function and not the VB page. See this page.
As you can see, the function takes strings as arguments. Because of that (or because the MSDN page says so - not in this case) it has both Unicode and ASCII versions. This means you can call it in two ways, as ShellAboutA and as ShellAboutW. Since NSIS is ASCII too you must call it as ShellAboutA.
Now to the DLL it's located in. According to the VB definition it's shell32.dll. This is usually at the bottom of the MSDN page (Import library - shell32.lib). So the line should look like this for now:
System::Call "shell32::ShellAboutA(
Now for the arguments. The first argument is "Window handle to a parent window. This parameter can be NULL.", though can be NULL we have the value so we will send it. HWND is a handle, and handles are to be sent as integers in System.dll. So our line will now look like:
System::Call "shell32::ShellAboutA(i $HWNDPARENT,
Next argument is the title, text title. Text is 't' in System.dll.
System::Call "shell32::ShellAboutA(i $HWNDPARENT, t 'My title#my second title',
Next argument is "other stuff", also text.
System::Call "shell32::ShellAboutA(i $HWNDPARENT, t 'My title#my second title', t 'other stuff, copyright 2003, bla bla bla'
Next, and last argument is a handle to an icon. To avoid loading icons with System.dll for now we'll just use the default icon and for that we'll pass on NULL (see the MSDN page). NULL is actually 0 and as I said before a handle is 'i' in System.dll, so:
System::Call "shell32::ShellAboutA(i $HWNDPARENT, t 'My title#my second title', t 'other stuff, copyright 2003, bla bla bla', i 0)
Last but not least is the return value. The return value is an integer, again i. So:
System::Call "shell32::ShellAboutA(i $HWNDPARENT, t 'My title#my second title', t 'other stuff, copyright 2003, bla bla bla', i 0) i .s"
The last .s means the return value will be pushed on the NSIS stack so you should pop to get its value.
Joel
9th July 2003 16:13 UTC
ok...thanks kichik..I think I learn now...
So easy, now....
I'll try with other Win32 API's
Thanks...
Joel
9th July 2003 16:56 UTC
sorry, me again...
What's a hdc and how to use it with system?
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, _
ByVal nIndex As Long) As Long
kichik
10th July 2003 13:33 UTC
This MSDN page provides information about device contexts. HDC is a handle to a device context. You usually get it by using the GetDC function.