topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 18, 2024, 10:05 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: GlassPrompt 1.1  (Read 20383 times)

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #25 on: September 19, 2010, 11:03 AM »
Decent article, Eóin - a funny little thing from it, though:
If you look at the details of the process from within Process Explorer, you’ll notice that the ComSpec is set to cmd.exe, a clear indication that it’s hosting the command prompt.
Oh really? I thought that was just the standard system environment variable that you'll see in every process ;)
- carpe noctem

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #26 on: September 19, 2010, 01:32 PM »
I definitely prefer to use .rc files when doing simple-ish GUIs for ligthweight C++ apps. Once you need anything fancy (like auto-resizing), you're better off using some framework...

Thanks for the ResEdit link :)

In this Code Project article he provides skeleton code for a dialog app using the editor:

http://www.codeproje...dit.aspx?msg=3102372

Although it would have been a tad more useful if he showed adding your own icon as the application icon as that's the more common case then sticking it in a picture box.


« Last Edit: September 19, 2010, 01:34 PM by MilesAhead »

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #27 on: September 19, 2010, 02:25 PM »
Although it would have been a tad more useful if he showed adding your own icon as the application icon as that's the more common case then sticking it in a picture box.

Perhaps he followed the MSVS resource editors behavior a bit too closely, as I've always found it to be a bit of a PITA for much the same reason.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #28 on: September 19, 2010, 02:32 PM »
Adding your application as the application icon? Simple - define it as the first icon in the resource file :) (or rather, the icon with the lowest identifier number; usually you use 100, but afaik anything goes, as long as it's the lowest). I think it's actually the shell (explorer.exe) that chooses to show the lowest icon number, rather than having anything to do with the resource editor or compiler.
- carpe noctem

Eóin

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
    • View Profile
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #29 on: September 19, 2010, 02:35 PM »
I believe the application's icon has is simply the first icon in it's resources, so actually he did set the custom icon as the app one.

[edit] oops too late.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #30 on: September 19, 2010, 02:36 PM »
Although it would have been a tad more useful if he showed adding your own icon as the application icon as that's the more common case then sticking it in a picture box.

Perhaps he followed the MSVS resource editors behavior a bit too closely, as I've always found it to be a bit of a PITA for much the same reason.

Heh. As soon as I wrote that it prompted me to look at his one liner for setting the dialog icon again.  I got it to work by using the same trick MS programmers do in the win32 template.  Copy hInstance given in WinMain to the global hInst.  Then just use MAKEINTRESOURCE macro for my custom icon id.  More elegant than the use of LoadImage as shown in the MSDN example.

Instead of his init dialog line
SetClassLongPtr(hDlg, GCLP_HICON, (long)LoadIcon(0, IDI_APPLICATION));

I just used
SetClassLongPtr(hDlg, GCLP_HICON, (long)LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON)));


bah... I hate making all the newb mistakes all over again though.  Not linking with MT switch and getting dll dependency booby trapped all over again!! :(

But at least it's a way of doing stand-alone exe with a gui editor that emits pretty small code for small utils. :)


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #31 on: September 19, 2010, 02:46 PM »
Adding your application as the application icon? Simple - define it as the first icon in the resource file :) (or rather, the icon with the lowest identifier number; usually you use 100, but afaik anything goes, as long as it's the lowest). I think it's actually the shell (explorer.exe) that chooses to show the lowest icon number, rather than having anything to do with the resource editor or compiler.

That works fine with standard win32 apps.  No joy in this probably because the win32 template where all the icon handles are set is not used.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #32 on: September 19, 2010, 02:50 PM »
Oh, you mean the "upper-left-corner" icon rather than what's shown in explorer? Yeah, that requires code.
- carpe noctem

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #33 on: September 19, 2010, 02:55 PM »
In Windows Seven it shows up easily.  They must have improved the scrollbar draw when it's glass.

Indeed they did! This was why it didn't work pre Win7.

Interesting link. I'm not a habitual console drag dropper(I saw an article saying how great VistaSwitcher was so I hit Alt-Tab only to find I already had it installed... guess I don't Atl-Tab much) but I did notice a lot of griping about it when Vista first came on the scene.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: GlassPrompt 1.1
« Reply #34 on: September 19, 2010, 03:04 PM »
Oh, you mean the "upper-left-corner" icon rather than what's shown in explorer? Yeah, that requires code.

The way he did it was pretty neat though.  I can recall using LoadImage in Delphi similar to how MS suggests.  Delphi let you assign icons to custom controls, but if you made an ActiveX control out of them, you had to kludge it yourself to get the custom icon to display a design time icon when dropped on a form. But I'll say one thing for the Delphi 5 wizard created ActiveX. If it installed in the IDE it worked as expected.  Usually the biggest headache was getting the thing to stay in the toolbox. :)