Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wrong icon is shown
Message
 
To
23/03/2004 09:03:26
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00888645
Message ID:
00889036
Views:
20
Rolf,

Inspired in your comment about the API, I used my limited knowledge of it to try to change the icon thru it, to my surprise the behaivour is exactly the same, meaning that it works with ShowInTaskBar set to .T., but it doesn't if it is set to .F.

This is your code with the modifications to change the Icon thru the API (i used little or no error checking), note that the "this.icon=" is commented out to check that the icon is set with the API,
clear
oform1=newobject("form1")
oform1.show
return


define class form1 as form

	top = 0
	left = 0
	height = 200
	width = 450
	showwindow = 2
	showintaskbar = .f.
	docreate = .t.
	caption = "Hold down ALT and press TAB. What icon do you see?"
	controlbox = .t.
	maxbutton = .f.
	minbutton = .f.
	name = "Form1"

	add object command1 as commandbutton with ;
		top = 132, ;
		left = 204, ;
		height = 27, ;
		width = 84, ;
		caption = "Close", ;
		name = "Command1"


	procedure load

		declare SetLastError in kernel32 integer dwErrCode

		declare integer GetLastError in kernel32

		declare integer LoadImage in user32;
			integer hinst,;
			string  lpszName,;
			integer uType,;
			integer cxDesired,;
			integer cyDesired,;
			integer fuLoad

		declare integer SendMessage in user32;
			integer hwnd,;
			integer Msg,;
			integer wParam,;
			integer lparam

		* this.icon = home()+"graphics\icons\flags\flgden.ico"
		SetLastError(0)
		hIcon = LoadImage(0, home()+"graphics\icons\flags\flgden.ico", 1, 0, 0, 0x0010)

		if hIcon<1 or GetLastError()#0
			? "Error", hIcon, GetLastError()
		endif

		SetLastError(0)
 		? SendMessage(thisform.hwnd, 0x0080, 1, hIcon), GetLastError()
		SetLastError(0)
		? SendMessage(thisform.hwnd, 0x0080, 0, hIcon), GetLastError()
 	endproc


	procedure command1.click
		thisform.release
	endproc


enddefine
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform