Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Messagebox()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00388839
Message ID:
00389044
Vues:
20
Hi Ron,

>Is there a way to manipulate a messagebox() so that the box displays my icons instead of the usual icons like a question mark, etc...

Sure... But it's not easy. :)

First of all download my Struct class from the library here. Make sure it's my one, there's at least one other.

OK, now the more difficult part. You need to create a resource file. For that you need either Visual Basic, Visual C++ or another resource editor. Check the help file how to create a resource file. The following sample uses the PIFMGR.DLL as a resource file. It contains the standard icons for MS-DOS programs in Windows. On Windows 9x you must change the "System32" directory to "System".
Local loMsgBox
Set ClassLib to Struct Additive
Declare Long LoadLibrary in Win32API String
Declare Long MessageBoxIndirect in Win32API String
lnHandle = LoadLibrary( GetEnv("WinDir")+"\System32\PifMgr.DLL" )
loMsgBox = CreateObject( "MSGBOXPARAMS2" )
With loMsgBox
   .cbSize = loMsgBox.SizeOf()
   .hInstance = m.lnHandle
   .lpszIcon = 11   && the resource ID
   .dwStyle = 0x00000080
   .lpszText = "FoxPro rocks!"
   .lpszCaption = "Demo...Demo..."
Endwith
MessageBoxIndirect( loMsgBox.GetString() )

Define Class MSGBOXPARAMS2 as Struct
	cbSize = 0
	hwndOwner = 0
	hInstance = 0
	lpszText = ""
	lpszCaption = ""
	dwStyle = 0
	lpszIcon = 0
	dwContextHelpID = 0
	lpfnMsgBoxCallback = 0
	dwLanguageID = 0
	cMembers = ;
      "UINT              ul:cbSize,"+ ;
      "HWND              ul:hwndOwner,"+ ;
      "HINSTANCE         ul:hInstance,"+ ;
      "LPCTSTR           pz:lpszText,"+ ;
      "LPCTSTR           pz:lpszCaption,"+ ;
      "DWORD             ul:dwStyle," + ;
      "LPCTSTR           ul:lpszIcon," + ;
      "DWORD             ul:dwContextHelpID," + ;
      "MSGBOXCALLBACK    ul:lpfnMsgBoxCallback," + ;
      "DWORD             ul:dwLanguageID"
Enddefine
Christof
--
Christof
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform