|
Nevermind. I went back to using char and it works just fine. Thanks Dave! Your help is always appreciated.
|
|
|
|
|
Hi All,
What is the difference between a simple win32 application and a win32 console application?
Thanks in advance
Preeti9
|
|
|
|
|
the console application is a command line application, no graphical user interface ( GUI ).
the simple win32 can be a console application but it can also be an application that have a GUI.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thanks for your quick reply....Thanks once again
Preeti9
|
|
|
|
|
How can I from my view show only in time either the Date (day/month/year) ,either the time. Not the two Date and time in same time
I learn my self
|
|
|
|
|
Is this what you are asking about:
COleDateTime dateTime;
CString strDate = dateTime.Format("%x");
CString strTime = dateTime.Format("%X");
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
No, I put one an Edit control one my formview or Dialog, and i define a member variable with classwizard like m_date that is type is COleDateTime.
When the view or dialog is display, they show date and time together.
I need to show one of them , either date or date only. What to do
I learn my self
|
|
|
|
|
mikobi wrote:
I need to show one of them , either date or date only.
Ok, so just populate the edit control with m_date.Format() liked I showed.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi
what i mean is that if i clicked the item4 "---1。2--------" ,how to confirm i real did that in code.
----------------- 1
--1-------------- 2
---1。1-------- 3
---1。2-------- 4
---1。3-------- 5
--2-------------- 6
---2。1-------- 7
---2。2-------- 8
---2。3-------- 9
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
Are you talking about the TVN_SELCHANGED notification?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
yes i am ,TVN_SELCHANGED or NM_CLICK
you know the answer? please give a hint
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
See here.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
so sad it doesn't help
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
try88 wrote:
so sad it doesn't help
Why?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I'm not sure I understand what you want to confirm.
when you click on a tree item, you will have a TVN_SELCHANGED notification ( add an handler for that ), in the handler you will receive the HTREEITEM that is selected.
something like :
void MyTree::OnTreeSelchanged( NMHDR* pNMHDR, LRESULT* pResult )
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM item = pNMTreeView->itemNew.hItem;
}
if you want to check for a "hardcoded" string, CTreeCtrl::GetItemText( ... ) might be what you want to check for.
otherwise, I'm not certain.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
look at this figure:
----------------- 1
--1-------------- 2
---1。1-------- 3
---1。2-------- 4
---1。3-------- 5
--2-------------- 6
---2。1-------- 7
---2。2-------- 8
---2。3-------- 9
you know when i click the item for example item 4 which is"---1。2--------";
the question is how can i know that i clicked the item is item4 not others by code in my function OnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult) ?
that means how to judge the item clicked is the one i want in code.
your hint using GetItemText( ... ) maybe bot work when my item text is put dynamically,for you even not konw the exact text.
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
try88 wrote:
...how can i know that i clicked the item is item4 not others by code...
By looking at the NMTREEVIEW structure, specifically the itemNew member.
try88 wrote:
your hint using GetItemText( ... ) maybe bot work when my item text is put dynamically,for you even not konw the exact text.
What? How else are you going to add text if not dynamically? Tree controls are not populated at design/compile time. If an item has text, that text can be retrieved via GetItemText() . Have you looked at the documentation for how this function works?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
HTREEITEM item = pNMTreeView->itemNew.hItem; tells you what item you clicked on.
if you add things dynamically to the tree, you will need to attach some kind of user data to each item ( or leaves ) of the tree with CTreeCtrl::SetItemData to identify it.
besides, your figure it not clear at all; what is the tree data ? what is the item number ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
thank you !!
Maximilien wrote:
SetItemData to identify it
is just what i searching for days! God will bless you!! thank you !!
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
I have device driver and I want to write in a file from within the driver.
I am using ZwCreateFile()
ZwWriteFile()
ZwClose() functions.
When I call the InitializeObjectAttributesfunction()
i do not know how should the object name look like.
I mean if my file name is: D:\\status.txt or something like this:
\Device\HarddiskVolume1\status.txt
I want to ask now if these are the functions I should use when writting in a file from the kernel:
Here is a piece of code.
Can someone tell me what I do wrong?
NTSTATUS WriteStatusInFile(
IN PCWSTR FileName,
IN HANDLE hProcessId
)
{
UNICODE_STRING ObjN;
OBJECT_ATTRIBUTES ObjAttrib;
UNICODE_STRING ObjName;
IN HANDLE hFile;
IN IO_STATUS_BLOCK StatBlock,WStatBlock;
RtlInitUnicodeString(&ObjN,L"\\D:\\status.txt");
InitializeObjectAttributes(&ObjAttrib,&ObjN, OBJ_KERNEL_HANDLE , NULL, NULL);
ZwCreateFile(&hFile,
FILE_WRITE_DATA|FILE_APPEND_DATA,
&ObjAttrib,
&StatBlock,
0,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_WRITE,
FILE_CREATE |FILE_OPEN,
FILE_SEQUENTIAL_ONLY,
NULL,
0
);
ZwWriteFile(
hFile,
NULL,
NULL,
NULL,
&WStatBlock,
L"Process Created or Terminated\n",
sizeof("Process Created or Terminated\n"),
NULL,
NULL
);
ZwClose(hFile);
return WStatBlock.Status;
}
Thanks in advance.
gabby
|
|
|
|
|
This is how its done.
Its a code chunk out of an ndis driver but its the same as what you wil want:
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
UNICODE_STRING ObjectName;
RtlInitUnicodeString(&ObjectName, L"\\DosDevices\\C:\\R_NDIS.txt");
InitializeObjectAttributes(&ObjectAttributes,
&ObjectName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
Status = ZwCreateFile( &hfile,
GENERIC_WRITE,
&ObjectAttributes,
&IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_OVERWRITE_IF,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_ALERT,
NULL,
0);
if(IoStatusBlock.Status != STATUS_SUCCESS)
{
DBGPRINT(ERROR, ("Couldn't create file\n"));
}
else
{
/// write data...
Nunc est bibendum!
|
|
|
|
|
Hi,
I have a CWinApp from where I start a dialog box. In the dialog box I have an Edit box and other controls.
In the Oncreate of dialogbox, I am registering a callback function.
The function say f() to be called is in the same cpp file as the app. The callback procedure is done in a DLL.
I need to set text in the Dialog box's edit box from this function.
the function is written as below:
I tried AfxGetMainWnd() and use GetDlgItemText. but that doesn't work.
Even Messagebox doesn't show-up, same time I don't get errors also
PLEASE GIVE ME A SOLUTION !!!!!!!!!
int
WINAPI
MyNotify( )
{
CWnd CMainWindow;
CWnd *pMainWnd = (CWnd *)AfxGetMainWnd();
CWinApp *pAppWnd = AfxGetApp();
pMainWnd->MessageBox("in call back");
pMainWnd->GetDlgItemText(IDC_EDITCustLog,szCustLogA);
szCustLogA += "\r\n-- in call back --";
pMainWnd->SetDlgItemText(IDC_EDITLog, szCustLogA);
return TRUE;
}
- KK
|
|
|
|
|
Is MyNotify() exported properly?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
MyNotify is ok. It is being called. But if I write MessageBox("Hello"); I get an error, MEssageBoxA does not take one parameter.
I guess this is because MyNotify is not member of CDialog.
I want to do a SetDlgItemText on a edit box in my Dialog.
So, how to access a edit box in a dialog from a function which is not a member of the dialog class ?
If it was a normal function, I could have passed a pointer of Dialog to the function and used it. But, this is a callback function. THe call back portion of it is working fine.
So other than passing a pointer to dialog, how to access a edit box in a dialog from a function which is not a member of the dialog class ?
-KK
- KK
|
|
|
|
|
kk_vp wrote:
But if I write MessageBox("Hello"); I get an error, MEssageBoxA does not take one parameter.
None of the three MessageBox() functions take just one parameter. Perhaps you are wanting to use AfxMessageBox() .
kk_vp wrote:
So other than passing a pointer to dialog, how to access a edit box in a dialog from a function which is not a member of the dialog class ?
Post a message to it. Let the owner of the control handle the actual updating.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|