Toon posts:

[C#] SystemParametersInfo SPI_SETFLATMENU

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik heb het volgende probleem, aan de hand van de volgende code kan ik de menu's plat maken in mijn applicatie

code:
1
2
3
4
5
6
[DllImport( "User32.dll" ) ]
static extern int SystemParametersInfo( int uAction, int uParam, string lpvParam, int fuWinIni );

const int SPI_SETFLATMENU = 0x1023;
....
SystemParametersInfo( SPI_SETFLATMENU, 0, "TRUE", 1);


dit werkt prima maar ik krijg de menu's niet meer normaal (behalve dan via het configuratiescherm).

Het lijkt mij dat de volgende code zou moeten voldoen

code:
1
2
3
4
5
6
[DllImport( "User32.dll" ) ]
static extern int SystemParametersInfo( int uAction, int uParam, string lpvParam, int fuWinIni );

const int SPI_SETFLATMENU = 0x1023;
....
SystemParametersInfo( SPI_SETFLATMENU, 0, "FALSE", 1);


Maar dat werkt dus niet

  • stp_4
  • Registratie: Maart 2003
  • Laatst online: 30-04 19:47
Waar staat die "False" van SystemParametersInfo dan voor?

stp - PSN ID: stp_4


Verwijderd

Topicstarter
SPI_SETFLATMENU

Enables or disables flat menu appearance for native User menus. Set pvParam to TRUE to enable flat menu appearance or FALSE to disable it.
When enabled, the menu bar uses COLOR_MENUBAR for the menubar background, COLOR_MENU for the menu-popup background, COLOR_MENUHILIGHT for the fill of the current menu selection, and COLOR_HILIGHT for the outline of the current menu selection. If disabled, menus are drawn using the same metrics and colors as in Windows 2000 and earlier.

Windows 2000/NT and Windows Me/98/95: This value is not supported.


bron: http://msdn.microsoft.com.../systemparametersinfo.asp

Zoals je dus hier boven kunt lezen kun je met TRUE flatmenu aanzetten en met FALSE uit.

Maar hij zet het alleen maar AAN (TRUE) en niet UIT (FALSE)

  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

Een gokje, hoor (ben niet zo erg bekend met C#), maar probeert de functie er niet een boolean van te maken? Dat een string "true" en een string "false" allebei naar (boolean) true evalueren?

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz


  • stp_4
  • Registratie: Maart 2003
  • Laatst online: 30-04 19:47
drm schreef op donderdag 10 februari 2005 @ 17:23:
Een gokje, hoor (ben niet zo erg bekend met C#), maar probeert de functie er niet een boolean van te maken? Dat een string "true" en een string "false" allebei naar (boolean) true evalueren?
;)

stp - PSN ID: stp_4


Verwijderd

Topicstarter
Ja klopt, dat dacht ik ook maar dan krijg ik een error: Argument '3': cannot convert from 'bool' to 'string'

Had dit al geprobeerd (stom dat ik dat niet vermeld had). Ik vind het een beetje vaag dat ie het met een string wel doet en met een bool niet

  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

Bball1607:
Ja klopt, dat dacht ik ook maar dan krijg ik een error: Argument '3': cannot convert from 'bool' to 'string'
Dat vind ik niet zo gek, want in jouw functie-voorschrift staat dat het een string moet zijn. In MSDN lees ik echter iets anders:
code:
1
2
3
4
5
6
BOOL SystemParametersInfo(
  UINT uiAction,
  UINT uiParam,
  PVOID pvParam,
  UINT fWinIni
);

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz


Verwijderd

Topicstarter
Got a point STOM STOM STOM

nu werkt ie dus wel

het moest dus zo

[code]
static extern int SystemParametersInfo( int uAction, int uParam, bool lpvParam, int fuWinIni );
[code]

super thnx for all the help

  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

Ik zou zeggen, maak er dan een object parameter van. Dan kun je 'm ook nog 's voor andere typen gebruiken ;) (ik neem aan dat er geen void type beschikbaar is in C# behalve als returntype)

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz

Pagina: 1