Click here to Skip to main content
15,914,452 members
Home / Discussions / C#
   

C#

 
AnswerRe: tabcontrol problem ? howto check if a different tab is clicked ? Pin
Andrei Ungureanu12-Jun-06 4:18
Andrei Ungureanu12-Jun-06 4:18 
GeneralRe: tabcontrol problem ? howto check if a different tab is clicked ? Pin
Mairaaj Khan12-Jun-06 20:53
professionalMairaaj Khan12-Jun-06 20:53 
QuestionHow to Clear data from DataGridView? Pin
Mairaaj Khan12-Jun-06 0:47
professionalMairaaj Khan12-Jun-06 0:47 
QuestionWritting listview items to xml file Pin
chandler8312-Jun-06 0:47
chandler8312-Jun-06 0:47 
AnswerRe: Writting listview items to xml file Pin
rah_sin12-Jun-06 0:50
professionalrah_sin12-Jun-06 0:50 
GeneralRe: Writting listview items to xml file Pin
chandler8312-Jun-06 1:11
chandler8312-Jun-06 1:11 
GeneralRe: Writting listview items to xml file Pin
rah_sin12-Jun-06 1:35
professionalrah_sin12-Jun-06 1:35 
QuestionProblem with TVM_GETITEM Pin
suguimoto12-Jun-06 0:44
suguimoto12-Jun-06 0:44 
Hello!

I can´t make SendMessage work with TVM_GETITEM!
I returns garbage always =/
This program is supposed to read a item´s name from a TreeView!

Here is the code:

public const int TV_FIRST = 0x1100;

public enum TV_Messages
{
TVM_GETNEXTITEM = (TV_FIRST + 10),
TVM_GETITEM = (TV_FIRST + 12), //62
TVM_GETCOUNT = (TV_FIRST + 5),
TVM_SELECTITEM = (TV_FIRST + 11),
TVM_DELETEITEM = (TV_FIRST + 1),
TVM_EXPAND = (TV_FIRST + 2),
TVM_GETITEMRECT = (TV_FIRST + 4),
TVM_GETINDENT = (TV_FIRST + 6),
TVM_SETINDENT = (TV_FIRST + 7),
TVM_GETIMAGELIST = (TV_FIRST + 8),
TVM_SETIMAGELIST = (TV_FIRST + 9),
TVM_GETISEARCHSTRING = (TV_FIRST + 64),
TVM_HITTEST = (TV_FIRST + 17),
}
public const int TVIF_TEXT = 0x0001;
public const int TVIF_PARAM = 0x4;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct TVITEM
{
public int mask;
public IntPtr hItem;
public int state;
public int stateMask;
public IntPtr pszText;
public int cchTextMax;
public int iImage;
public int iSelectedImage;
public int cChildren;
public IntPtr lParam;
}

private void button1_Click(object sender, EventArgs e)
{
TVITEM tvItem = new TVITEM();
tvItem.hItem = (IntPtr)Int32.Parse(textBox1.Text);
tvItem.cchTextMax = 512;
tvItem.mask = TVIF_TEXT;
tvItem.pszText = Marshal.AllocHGlobal(512);

IntPtr ptrTvi = Marshal.AllocHGlobal(Marshal.SizeOf(tvItem));
Marshal.StructureToPtr(tvItem, ptrTvi, false);

SendMessage(TreeHandle, (int)TV_Messages.TVM_GETITEM, IntPtr.Zero, ptrTvi); // TreeHandle got from FindWindow and FindWindowEx

string text = Marshal.PtrToStringAuto(tvItem.pszText);

MessageBox.Show(text);
Marshal.FreeHGlobal(tvItem.pszText);
Marshal.FreeHGlobal(ptrTvi);
}
}
If anyone got any idea, please help me!

Thanks!
QuestionFile Downloading - Help Please Pin
Andrew Mercer12-Jun-06 0:17
Andrew Mercer12-Jun-06 0:17 
QuestionDataGridView.SelectedRows to DataTable in C# Pin
peshawarcoder11-Jun-06 23:03
peshawarcoder11-Jun-06 23:03 
QuestionCrystal reports - Keycodev2.dll Pin
SysJey11-Jun-06 22:48
SysJey11-Jun-06 22:48 
Questionveryyyy urgent..............online status [modified] Pin
ayshamushtaq11-Jun-06 22:44
ayshamushtaq11-Jun-06 22:44 
QuestionEmail Management Pin
Tiger45611-Jun-06 22:17
Tiger45611-Jun-06 22:17 
AnswerRe: Email Management Pin
ahall@mirapoint.com12-Jun-06 7:40
ahall@mirapoint.com12-Jun-06 7:40 
QuestionC# printing XML or txt File [modified] Pin
oskardiazdeleon11-Jun-06 21:15
oskardiazdeleon11-Jun-06 21:15 
QuestionConversion of DataGridView.SelectedRows to ... in C# Pin
peshawarcoder11-Jun-06 20:51
peshawarcoder11-Jun-06 20:51 
QuestionHow call events from another event Pin
ranandbe11-Jun-06 20:18
ranandbe11-Jun-06 20:18 
AnswerRe: How call events from another event Pin
stancrm11-Jun-06 20:27
stancrm11-Jun-06 20:27 
AnswerRe: How call events from another event Pin
engsrini11-Jun-06 20:46
engsrini11-Jun-06 20:46 
AnswerRe: How call events from another event Pin
Guffa11-Jun-06 21:07
Guffa11-Jun-06 21:07 
QuestionSend Mail Without Using SMTP Server Pin
Sushant Duggal11-Jun-06 20:18
Sushant Duggal11-Jun-06 20:18 
AnswerRe: Send Mail Without Using SMTP Server Pin
leppie11-Jun-06 20:29
leppie11-Jun-06 20:29 
GeneralRe: Send Mail Without Using SMTP Server Pin
Sushant Duggal11-Jun-06 20:32
Sushant Duggal11-Jun-06 20:32 
GeneralRe: Send Mail Without Using SMTP Server Pin
stancrm11-Jun-06 20:36
stancrm11-Jun-06 20:36 
GeneralRe: Send Mail Without Using SMTP Server Pin
Sushant Duggal11-Jun-06 20:39
Sushant Duggal11-Jun-06 20:39 

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.