[comp.windows.ms.programmer] Beginner Help

markb@csg.uwaterloo.ca (Mark Brezina) (05/22/91)

	I've only been programming windows for a couple of weeks so these 
	questions may seem obvious...
 
	How do I initialize a radio button to be selected?
 
	Does a bitmap handle to the clipboard have to be locked (using
	GlobalLock) before the bits can be examined?
 
	How do I create a windows application that is simply a dialoge box
	(no menu, no window) I would like a file requestor to come up when
	the application is launched.  No menus or windows are needed.
	                                               
 
	Thanks for any help.

bcw@rti.rti.org (Bruce Wright) (05/22/91)

In article <1991May21.183435.15832@maytag.waterloo.edu> markb@csg.uwaterloo.ca (Mark Brezina) writes:
>
>	I've only been programming windows for a couple of weeks so these 
>	questions may seem obvious...
> 
>	How do I initialize a radio button to be selected?

Use the CheckRadioButton call in the WM_INITDIALOG message processing
for your dialog box.

>	Does a bitmap handle to the clipboard have to be locked (using
>	GlobalLock) before the bits can be examined?

If you are copying them with GetBitmapBits or CopyBitmap, no.  In 
general you need to lock any time you get a long pointer to a
memory address other than your own data segment during the processing
of a single message.

>	How do I create a windows application that is simply a dialoge box
>	(no menu, no window) I would like a file requestor to come up when
>	the application is launched.  No menus or windows are needed.

You do a CreateDialog instead of a CreateWindow call in your WinMain
routine.  Note that you need to allocate extra space in your window
structure by setting wndclass.cbWndExtra = DLGWINDOWEXTRA before you
call the CreateDialog routine - otherwise you will corrupt memory.

All of this is explained in much more detail in Petzold's book
(Programming Windows), which is an excellent introduction to Windows 
programming.  Trying to learn Windows programming without using it 
(or a similar book, though Petzold is probably the best of the lot) 
is like trying to program with both hands tied behind your back.  
Heavily recommended.

Good luck -

						Bruce C. Wright

bonneau@hyper.hyper.com (Paul Bonneau) (05/22/91)

In article <1991May21.183435.15832@maytag.waterloo.edu> markb@csg.uwaterloo.ca (Mark Brezina) writes:
>	I've only been programming windows for a couple of weeks so these 
>	questions may seem obvious...
> 
>	How do I initialize a radio button to be selected?
CheckRadioButton()

> 
>	Does a bitmap handle to the clipboard have to be locked (using
>	GlobalLock) before the bits can be examined?
> 
Once you have obtained a bitmap handle, you can use the
function GetBitmapBits() to copy the bits into a buffer you
supply.

>	How do I create a windows application that is simply a dialoge box
>	(no menu, no window) I would like a file requestor to come up when
>	the application is launched.  No menus or windows are needed.
>
I have never tried this, but I suppose you could simply call
DialogBox() from WinMain().  Don't even bother with the
message loop (DialogBox() uses its own), and just return
after the call (assuming this is the behaviour you want).
Oh yes, use GetActiveWindow() to supply the parent window
handle (hWndParent).

cheers - Paul Bonneau.

ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (05/22/91)

How to initialize a radio btn to be selected:

SendMessage(HwndButton, BM_SETCHECK, 1, 0)

(Petzold, p. 216).

For details about locking & unlocking & the clipboard, see chapter 16.

Terrell