Click here to Skip to main content
15,905,971 members
Home / Discussions / C#
   

C#

 
QuestionHow to draw text in Standard mode in CF? Pin
pmasknguyen25-Mar-06 21:48
pmasknguyen25-Mar-06 21:48 
Questionlistview problem Pin
Mridang Agarwalla25-Mar-06 16:49
Mridang Agarwalla25-Mar-06 16:49 
AnswerRe: listview problem [Modified] Pin
Ravi Bhavnani25-Mar-06 16:54
professionalRavi Bhavnani25-Mar-06 16:54 
AnswerRe: listview problem Pin
Sean8925-Mar-06 16:57
Sean8925-Mar-06 16:57 
GeneralRe: listview problem Pin
Mridang Agarwalla25-Mar-06 17:38
Mridang Agarwalla25-Mar-06 17:38 
GeneralRe: listview problem Pin
cbhkenshin25-Mar-06 18:36
cbhkenshin25-Mar-06 18:36 
QuestionGIS in the C# Pin
taybalo25-Mar-06 15:53
taybalo25-Mar-06 15:53 
QuestionSaving a Toolbar State to Registry? Pin
redfish3425-Mar-06 12:27
redfish3425-Mar-06 12:27 
I am trying to save a toolbar state to registry for later restore. But i seem unable to work with the Win32 API correctly. Can someone help? The problem is with the TBSAVEPARAMS struct. It wants a handle to the registry key (HKEY_LOCAL_MACHINE in this case) but where do i get this? I have tried passing the HKEY_LOCAL_MACHINE const 0x80000002 but i get a memory cannot be read error when i execute SendMessage TB_SAVERESTORE. I have tried the NET Registry.LocalMachine but i am unable to turn this into a pointer needed for the struct.

So what options are available? Is this impossible in NET? Below is the code i am using.

[StructLayout(LayoutKind.Sequential)]
public struct TBSAVEPARAMS
{
public UIntPtr hkr;
public string pszSubKey;
public string pszValueName;
}

[DllImport("user32.dll")]
public static extern int SendMessage(
IntPtr hWnd,
uint msg,
bool wParam,
Win32Struct.TBSAVEPARAMS lParam);

// open registrykey
// create key if needed
RegistryKey key = null;
string regKey = @"SOFTWARE\TEST";
key = Registry.LocalMachine.OpenSubKey(regKey, true);
// check errors
if (key == null)
{
return;
}
// close registry key
key.Close();

// get toolbar handle
IntPtr hWndToolBar = TrayIcons.GetIconTrayWnd();

// set up restore struct
Win32Struct.TBSAVEPARAMS tbSaveParams = new Win32Struct.TBSAVEPARAMS();
tbSaveParams.hkr = (UIntPtr)Win32Const.HKEY_LOCAL_MACHINE;
tbSaveParams.pszSubKey = regKey;
tbSaveParams.pszValueName = "Toolbar";

// save tray icon state
int result = Win32Windows.SendMessage(hWndToolBar,
(uint)Win32Const.TB_SAVERESTOREA, true, tbSaveParams);
Debug.WriteLine("result: " + result);



AnswerSome Progress, Still Need Help Pin
redfish3425-Mar-06 17:03
redfish3425-Mar-06 17:03 
QuestionExplain please... Pin
KORCARI25-Mar-06 11:26
KORCARI25-Mar-06 11:26 
AnswerRe: Explain please... Pin
Sean8925-Mar-06 11:59
Sean8925-Mar-06 11:59 
AnswerRe: Explain please... Pin
Guffa25-Mar-06 12:01
Guffa25-Mar-06 12:01 
QuestionMessagbox, listbox or combobox Pin
Yakup Ertas25-Mar-06 9:52
Yakup Ertas25-Mar-06 9:52 
Questioni image in listview Pin
yosba22125-Mar-06 9:48
yosba22125-Mar-06 9:48 
AnswerRe: i image in listview Pin
redfish3425-Mar-06 12:33
redfish3425-Mar-06 12:33 
AnswerRe: i image in listview Pin
Luis Alonso Ramos26-Mar-06 17:40
Luis Alonso Ramos26-Mar-06 17:40 
QuestionCollectionEditor Code Clean Up Pin
cnich2325-Mar-06 9:34
cnich2325-Mar-06 9:34 
QuestionDrawing Shapes Pin
Anindya Chatterjee25-Mar-06 9:26
Anindya Chatterjee25-Mar-06 9:26 
QuestionHow to make a searh function? Pin
AeQuitaZ25-Mar-06 8:19
AeQuitaZ25-Mar-06 8:19 
AnswerRe: How to make a searh function? Pin
Luis Alonso Ramos26-Mar-06 17:43
Luis Alonso Ramos26-Mar-06 17:43 
QuestionSupressing a MessageBox Pin
eggie525-Mar-06 7:40
eggie525-Mar-06 7:40 
AnswerRe: Supressing a MessageBox Pin
Ravi Bhavnani25-Mar-06 8:06
professionalRavi Bhavnani25-Mar-06 8:06 
GeneralRe: Supressing a MessageBox Pin
eggie525-Mar-06 8:08
eggie525-Mar-06 8:08 
AnswerRe: Supressing a MessageBox Pin
Luis Alonso Ramos25-Mar-06 8:59
Luis Alonso Ramos25-Mar-06 8:59 
GeneralRe: Supressing a MessageBox Pin
cnich2325-Mar-06 9:38
cnich2325-Mar-06 9:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.