|
You can do that only with a static method of the class. But if your method has to access instance members then you must find a way to pass them (perhaps the whole instance of the class) to it.
|
|
|
|
|
Tks for you all. I hope that works now.
|
|
|
|
|
Alex Cutovoi wrote: So fellows what I have to do to solve this??
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Tks for you all. I hope that works now.
|
|
|
|
|
in a dialog have some buttons and a treeCtrl
i am overriding the function PreTranslateMessage to get the pressed key and do some processing depending on this key
the problem is :
whenever i press any key the default BEEP windows sound is played
why is that and how can i stop it
thnx 4 ur time and concern.
|
|
|
|
|
I think this is a feature of Windows OS -- beeping if a key cannot be processed by the focused control, like button.
Maybe you should return TRUE from your PreTranslateMessage for all of your keys, thus stopping further processing?
I hope this helps.
|
|
|
|
|
yea this help
now the problem solved
thnx alot 4 ur help
|
|
|
|
|
To eliminate the 'hang' you would be better off using threads. As for updating the display, without seeing your code I can only guess. But the WM_PAINT which would be responsible for displaying the data is Posted and processed when no other messages are in the que. I'm guessing that you are blocking your main message loop with your file reading, which would prevent you from seeing any updated data, regardless of whether you sent it to a control or not. Again, a thread would fix this problem, or process messages within your lengthy procedures.
|
|
|
|
|
i am able to show the popup menu
when user right clicks on tree view item
but now the problem is that when user clicks on some
Menuitem then the control doesn't reaches to the respective
menu handler in fact nothing is getting called
below is the code for showing the pop uo menu
void CTreeViewDlg::OnNMRclickTree1(NMHDR *pNMHDR, LRESULT *pResult)
{
CPoint ptMouse;
DWORD dwPos;
UINT nFlags;
CTreeCtrl *pTreeCtrl;
pTreeCtrl = (CTreeCtrl *)GetDlgItem(IDC_TREE1);
{
dwPos = ::GetMessagePos();
ptMouse.x = LOWORD (dwPos);
ptMouse.y = HIWORD (dwPos);
CPoint ptAction = ptMouse;
// convert coordinates
pTreeCtrl->ScreenToClient(&ptAction);
// determine if click is on tree item
HTREEITEM hItemRClick = pTreeCtrl->HitTest(ptAction, &nFlags);
// if click is on tree item,
if (hItemRClick != NULL)
{
// set selection to right+clicked item
pTreeCtrl->SelectItem(hItemRClick);
HMENU hMenu = LoadMenu(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MENU1));
if(hMenu)
{
hMenu = GetSubMenu(hMenu,1);
if(hMenu)
{
TrackPopupMenu(hMenu,0,ptMouse.x,ptMouse.y,0,pTreeCtrl->m_hWnd,NULL);
}
}
}
}
*pResult = 0;
}
Thanks and regards
harshal
|
|
|
|
|
hi again,
and did you add ON_COMMAND handlers for each menu command ?
-----------
Mila
|
|
|
|
|
I think instead of
TrackPopupMenu(..., pTreeCtrl->m_hWnd, ...);
you should try
TrackPopupMenu(..., m_hWnd, ...);
I hope this helps.
|
|
|
|
|
Hi.
I have developed an aplication that it read and write bytes through the serial ports. The program works fine, except for some PCs, (very few ones). While is reading the data, sometimes it ends the communication suddenly.
I found that it happend because ClearCommError fails, I have the following code:
<br />
<br />
...<br />
<br />
while( retry> 0 )<br />
{<br />
<br />
if( !ClearCommError( idCommDev, &dwError,&comstatInfo ))<br />
{<br />
lResult = 116;<br />
dwLasError = GetLastError();
return lResult;<br />
}<br />
<br />
if( !PurgeComm( idCommDev, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR ))<br />
{<br />
lResult = 115;<br />
return lResult;<br />
}<br />
lResult = TXPacket(dataTX, 250);<br />
<br />
if( lResult!= 0 )<br />
return lResult;<br />
<br />
lResult = RXPacket(dataRX, timeout);<br />
....<br />
<br />
This is my problem. In some PC, (I don't know why), the function ClearCommError() fail with no error code available with GetLastError(), so I can't figure out what is happened.
Thank you.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
hi everyone,
I downloaded a E Y Player from Code project from the following link
http://www.codeproject.com/useritems/Media_Player.asp[^].... when i try to play *.mpg, *.avi,*.vob,*.dat files its playing fine .... BUT WHEN I TRY TO PLAY m2p files its giving error in MCIWndCreate(...) method .....
SO CAN ANYONE TELL ME WHETHER MCI SUPPORTS M2P FILE FORMATS(*.m2p files)?????????????
Thank You,
With Regards
Raja Bose
|
|
|
|
|
Dear All,
I am working with MSXML.
I cant write integer values on XML files as a tag.
Why ?
I want to write integer vaules into XML File.
Kindly Help me.
Thanks.
|
|
|
|
|
Sakthiu wrote: I cant write integer values on XML files as a tag.
Why do you want to do that?
Can't you prefix with an alphabetic char the numbers?
|
|
|
|
|
Hi,
I am having a SafeArray of bytes .I should know the size of it.
Is there any way where we can get the size of safearray?
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
My suggestions - look up the following functions:
SafeArrayGetDim(...)
SafeArrayGetElemsize(...)
SafeArrayGetLBound(...)
SafeArrayGetUBound(...)
Get The number of dimensions using the first function, use the third and forth ones to determine the number of elements in it. Use the second function to verify element size (size == 1 if using BYTE s/char s).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
i use the SHBrowseForFolder() API to prompt the user to select a folder.
but i can't open the dialog in a particuliar folder. how to do that please ?
-- TTD --
|
|
|
|
|
The pidlRoot parameter of the BROWSEINFO structure is used for that.
Do a search for that member and you will find ways to manage the ITEMIDLIST required for the structure.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
yes, i know that james, sorry for not having pointed out my tries.
actually, i called CoInitialise(NULL) first, and i tried to use SHParseDisplayName() to create a PCIDLIST_ABSOLUTE to give to the pidlRoot attribute of the structure, in vain
-- TTD --
|
|
|
|
|
super_ttd wrote: but i can't open the dialog in a particuliar folder. how to do that please ?
Have you supplied a callback function? That is where you establish the default folder.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Have you supplied a callback function?
hu, no ! i thought callbacks were only to extend the dialog style/events management...
Sir, can i ask you please to show me how you write such a function ?
thank you very much for your answer
|
|
|
|
|
super_ttd wrote:
hu, no ! i thought callbacks were only to extend the dialog style/events management...
You can use it for whatever you need.
super_ttd wrote: Sir, can i ask you please to show me how you write such a function ?
I could, but Googling for examples would prove a much more useful exercise.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Symphton
When I delete directory which contains some files I will not get message FILE_ACTION_REMOVED. This happens int XP professional SP1. I can't install SP2 because some others reasons.
My code
initialization of watching
DirInfo[0].hDir = CreateFile(sDirectory,
FILE_LIST_DIRECTORY,
FILE_SHARE_READ |
FILE_SHARE_WRITE |
FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS |
FILE_FLAG_OVERLAPPED,
NULL
);
if(DirInfo[0].hDir==INVALID_HANDLE_VALUE)
return IDS_ERRCREATEFILE;
hCompPort=0;
hCompPort=CreateIoCompletionPort( DirInfo[0].hDir,
hCompPort,
(DWORD) &DirInfo[0],
0);
if(!hCompPort)
return IDS_ERRCREATEIOPORT;
ReadDirectoryChangesW( DirInfo[0].hDir,
DirInfo[0].lpBuffer,
MAX_BUFFER,
TRUE,
FILE_NOTIFY_CHANGE_SECURITY|
FILE_NOTIFY_CHANGE_CREATION|
FILE_NOTIFY_CHANGE_LAST_ACCESS|
FILE_NOTIFY_CHANGE_LAST_WRITE|
FILE_NOTIFY_CHANGE_SIZE|
FILE_NOTIFY_CHANGE_ATTRIBUTES|
FILE_NOTIFY_CHANGE_DIR_NAME|
FILE_NOTIFY_CHANGE_FILE_NAME,
&DirInfo[0].dwBufLength,&DirInfo[0].Overlapped,
NULL);
watching loop in other thread
unsigned __stdcall CFileChangeWatch::DoFileChangeWatch(void *_pcFileChangeWatch)
{
DWORD numBytes;
DWORD cbOffset;
LPDIRECTORY_INFO di;
LPOVERLAPPED lpOverlapped;
PFILE_NOTIFY_INFORMATION fni;
CString szFullFileName;
CFileChangeWatch *pcFileChangeWatch=(CFileChangeWatch *)_pcFileChangeWatch;
char sBuff[256];
CString sPath;
do
{
GetQueuedCompletionStatus( (HANDLE) pcFileChangeWatch->hCompPort,
&numBytes,
(LPDWORD) &di,
&lpOverlapped,
INFINITE);
if ( di )
{
fni = (PFILE_NOTIFY_INFORMATION)di->lpBuffer;
do
{
cbOffset = fni->NextEntryOffset;
szFullFileName=di->lpszDirName;
szFullFileName=szFullFileName + "\\";
szFullFileName=szFullFileName+ CString(fni->FileName).Left(fni->FileNameLength / 2);
if(!strcmp(szFullFileName.Right(3),"fdf"))
{
DBAction
switch(fni->Action)
{
case FILE_ACTION_ADDED:
break;
case FILE_ACTION_REMOVED:
break;
case FILE_ACTION_MODIFIED:
break;
case FILE_ACTION_RENAMED_OLD_NAME:
break;
case FILE_ACTION_RENAMED_NEW_NAME:
break;
default:;
}
fni = (PFILE_NOTIFY_INFORMATION)((LPBYTE) fni + cbOffset);
} while( cbOffset );
ReadDirectoryChangesW( di->hDir,di->lpBuffer,
MAX_BUFFER,
TRUE,
FILE_NOTIFY_CHANGE_SECURITY|
FILE_NOTIFY_CHANGE_CREATION|
FILE_NOTIFY_CHANGE_LAST_ACCESS|
FILE_NOTIFY_CHANGE_LAST_WRITE|
FILE_NOTIFY_CHANGE_SIZE|
FILE_NOTIFY_CHANGE_ATTRIBUTES|
FILE_NOTIFY_CHANGE_DIR_NAME|
FILE_NOTIFY_CHANGE_FILE_NAME,
&di->dwBufLength,
&di->Overlapped,
NULL);
}
} while( di );
return 0;
};
-- modified at 9:28 Tuesday 21st November, 2006
|
|
|
|