Click here to Skip to main content
16,005,389 members
Home / Discussions / C#
   

C#

 
QuestionOnline Game - Communication Method? Pin
Eric Astor1-Jan-03 10:28
Eric Astor1-Jan-03 10:28 
AnswerRe: Online Game - Communication Method? Pin
Kannan Kalyanaraman1-Jan-03 18:58
Kannan Kalyanaraman1-Jan-03 18:58 
GeneralRe: Online Game - Communication Method? Pin
Eric Astor2-Jan-03 3:00
Eric Astor2-Jan-03 3:00 
GeneralIcons from executable Pin
Nick Parker1-Jan-03 10:20
protectorNick Parker1-Jan-03 10:20 
GeneralRe: Icons from executable Pin
Stephane Rodriguez.1-Jan-03 10:31
Stephane Rodriguez.1-Jan-03 10:31 
GeneralRe: Icons from executable Pin
Nick Parker1-Jan-03 10:43
protectorNick Parker1-Jan-03 10:43 
GeneralRe: Icons from executable Pin
Stephane Rodriguez.1-Jan-03 19:05
Stephane Rodriguez.1-Jan-03 19:05 
GeneralRe: Icons from executable Pin
Nick Parker2-Jan-03 5:51
protectorNick Parker2-Jan-03 5:51 
.S.Rod. wrote:
Otherwise, I am afraid you'll have to rely on P/Invoke : LoadLibrary() + LoadImage().

Ok, I feel like the smoke is starting to clear now, thank you. After looking up a few of the functions on MSDN I came up with the following:
[DllImport("kernel32.dll",CharSet=CharSet.Auto)]
static public extern IntPtr LoadLibrary(string lpFileName);

[DllImport("user32.dll",CharSet=CharSet.Auto)]
static public extern IntPtr LoadImage(IntPtr hinst,
                  string lpszName,
                  uint uType,
                  int cxDesired,
                  int cyDesired,
                  uint fuLoad);


And then I implement it like this:
Graphics grfx = Graphics.FromHwnd(this.Handle);
Rectangle rect = new Rectangle();
rect.X = 0;
rect.Y = 0;
rect.Width = 16;
rect.Height = 16;
     IntPtr i  = API.API.LoadLibrary(app1);
IntPtr i2 = API.API.LoadImage(i, app1, 1, 0, 0, 0x0010);
Icon ico = System.Drawing.Icon.FromHandle(i2);
grfx.DrawIcon(ico, rect);


I have noticed when I step through it that LoadImage returns 0 for i2 and then when I try to create the ico Icon it throws a System.ArgumentException saying the Win32 handle I passed to Icon is invalid or the wrong type. Any ideas?



Nick Parker

You see the Standards change. - Fellow co-worker


GeneralRe: Icons from executable Pin
Stephane Rodriguez.2-Jan-03 10:05
Stephane Rodriguez.2-Jan-03 10:05 
GeneralRe: Icons from executable Pin
Nick Parker2-Jan-03 11:43
protectorNick Parker2-Jan-03 11:43 
GeneralRe: Icons from executable Pin
Stephane Rodriguez.2-Jan-03 18:58
Stephane Rodriguez.2-Jan-03 18:58 
QuestionmySQL, what do you think? Pin
Jassim Rahma1-Jan-03 3:59
Jassim Rahma1-Jan-03 3:59 
AnswerRe: mySQL, what do you think? Pin
David Stone1-Jan-03 6:14
sitebuilderDavid Stone1-Jan-03 6:14 
AnswerRe: mySQL, what do you think? Pin
Adrian Hall2-Jan-03 10:43
Adrian Hall2-Jan-03 10:43 
GeneralRe: mySQL, what do you think? Pin
Jassim Rahma3-Jan-03 0:36
Jassim Rahma3-Jan-03 0:36 
GeneralRe: mySQL, what do you think? Pin
Adrian Hall3-Jan-03 5:15
Adrian Hall3-Jan-03 5:15 
Questionhotmail.com database? Pin
Jassim Rahma1-Jan-03 3:56
Jassim Rahma1-Jan-03 3:56 
AnswerRe: hotmail.com database? Pin
Mike Epprecht1-Jan-03 8:02
Mike Epprecht1-Jan-03 8:02 
GeneralRe: hotmail.com database? Pin
SimonS2-Jan-03 22:41
SimonS2-Jan-03 22:41 
GeneralRe: hotmail.com database? Pin
Adrian Hall3-Jan-03 5:26
Adrian Hall3-Jan-03 5:26 
GeneralVS Installers Pin
Jassim Rahma1-Jan-03 3:53
Jassim Rahma1-Jan-03 3:53 
QuestionHow can I trace a windows installer project? Pin
mkomasi31-Dec-02 22:48
mkomasi31-Dec-02 22:48 
AnswerRe: How can I trace a windows installer project? Pin
Stephane Rodriguez.31-Dec-02 23:11
Stephane Rodriguez.31-Dec-02 23:11 
GeneralRe: How can I trace a windows installer project? Pin
mkomasi1-Jan-03 1:48
mkomasi1-Jan-03 1:48 
GeneralRe: How can I trace a windows installer project? Pin
Stephane Rodriguez.1-Jan-03 2:08
Stephane Rodriguez.1-Jan-03 2:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.