|
|
|
Hi, I'm trying to prevent a richedit control from processing the WM_KEYDOWN keyboard event whenever the user presses the tab key. The code below does not work for some reason I don't know!! any ideas are appreciated.. thanks
<br />
case WM_NOTIFY:<br />
{<br />
LPNMHDR pNmhdr = (LPNMHDR)lParam;<br />
switch(pNmhdr->code) <br />
{ <br />
case EN_MSGFILTER:<br />
{<br />
MSGFILTER* pMsgFltr = (MSGFILTER *)lParam;<br />
switch(pMsgFltr->msg)<br />
{<br />
case WM_KEYDOWN:<br />
if (pMsgFltr->wParam == VK_TAB)<br />
{<br />
return 1;<br />
}<br />
break;<br />
}<br />
}<br />
break;<br />
} <br />
}<br />
break;<br />
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
Use WM_CHAR instead of WM_KEYDOWN
-Luis
|
|
|
|
|
now it works perfectly, thanks a lot...
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
I've got a DialogBar A docked at the top of the frame window.
How can I do to dock another DialogBar B at the right side of DialogBar A.
I tried pFrame->DockControlBar(pDialogBarA, AFX_IDW_DOCKBAR_TOP|AFX_IDW_DOCKBAR_RIGHT) but the AFX_IDW_DOCKBAR_xxx only refer to the frame window
|
|
|
|
|
|
Hi,
Please, forgive me to post to this specific forum. If that is not appropriate, could you point me to some more relevant place?
I'm a complete newbie in using lexx/yacc -like tools in order to build a syntax highlighter add-on to Visual Studio .NET. The thing that is bugging me is that:
each time the lexer recognizes a token, I cannot reliably retrieve the starting position of the matched text in the input string. I'm using something like this that fails for alternate start states in the lexer :
<br />
std::string line;<br />
...<br />
int a_token;<br />
int a_pos = 0;<br />
<br />
while ((a_token = m_lexer.yylex()) != 0) {<br />
<br />
int pos = line.find(m_lexer.YYText(), a_pos);<br />
int end = pos + m_lexer.YYLeng();<br />
<br />
a_pos = end + 1;<br />
The code works almost correctly most of the time (although it doesn't seem right). But it crashes for the input grammar :
<br />
%x single_quotes_string<br />
single_quote ''<br />
%%<br />
' { BEGIN(single_quotes_string); }<br />
<br />
<single_quotes_string>{<br />
[^'\n]*|{single_quote}* <br />
' BEGIN(INITIAL); return TK_STRING; }<br />
\n { BEGIN(INITIAL); return TK_STRING; }<br />
}<br />
%%<br />
<br />
--
Maxime Labelle
maxime.labelle@freesurf.fr
|
|
|
|
|
Hi All,
Im creating a dll and I want to put in the code a way to create a registry key. Im only trying to do something very simple - (1) Create a registry key & (2) Have a vaule pointing to the root of c:\
Ive just tried the basic regcreatekeyex method and although it compiles it does not actually create anything and I think ive missed something very fundamental here (please forgive the noobie status). Here is the code:
DWORD dwRes, dwDisposition;
SECURITY_ATTRIBUTES sa;
LONG lRes;
HKEY hkSub = NULL;
lRes = RegCreateKeyEx(HKEY_CURRENT_USER, "mykey", 0, "", 0,
KEY_READ | KEY_WRITE, &sa, &hkSub, &dwDisposition);
It compiles fine but when i run regedit and try to find "mykey" it comes up with nothing. Any help would be greatly appreciated. Thanks
Nic
|
|
|
|
|
try:
lRes = RegCreateKeyEx(HKEY_CURRENT_USER, "mykey", 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &hkSub, &dwDisposition);
Since you don^t fill the security attributes struct, passing a NULL pointer should do what you want. Same with classname.....
Greetings,
Davy
|
|
|
|
|
Hi guys
I've got an SDI app and from the view I call a dialog like this.
In CMyView.cpp
void CMyView::OpenMydialog()
{
CMyDialog dlg;
dlg.SetFather(this);
dlg.DoModal();
}
and in my dialog I do this
In MyDialog.h
class CMyView;
CMyView *m_pFather;
void SetFather(CMyView *p_pFather);
and in MyDialog.cpp
#include "myappView.h" (but due to this I have to include first myappDoc.h")
void CMyDialog::SetFather(CMyView *p_pFather) {
m_pFather=p_pFather;
}
What's the usual (and right) way to acces the parent (View) class without to add all these includes?
Now each time I compile , practically all app is compiled again and that's what I want to avoid.
Thanks in forwarding
Doc
|
|
|
|
|
void CMyView::OpenMydialog()
{
CMyDialog dlg(this);
dlg.DoModal();
}
//if you wonna get the parent in your dlg class
void CMyDialog::AMethod()
{
//get the parent
CWnd* pWnd = GetParent();
//you can also cast offcourse, but then you^ll need to include the MyView.h in the MyDialog.cpp:
CMyView* pMyView = (CMyView*)GetParent();
}
Hope this helps you,
Greetings,
Davy
|
|
|
|
|
The problem is that if I follow your example I don't have access to the view variables.
If I have a member called m_nCalls in my view
How do I access to it?
If I do
CWnd* pWnd = GetParent();
pWnd->m_nCalls
I receive compiling a nice
error C2039: 'm_nCalls' : is not a member of 'CWnd'
Doc
|
|
|
|
|
If you want to access members of your view class you`ll need to cast....
CMyView *pMyView = (CMyView*)GetParent();
pMyView->m_nCalls = 2;
don^t forget to do an
#include "MyView.h" in your MyDialog.cpp file then..
Greetings,
Davy
|
|
|
|
|
Another - more "correct" object oriented method - would be to pass the view's pointer to the dialog's constructor (as another poster pointed out). Then when the dialog needs to communicate with the view it would do so via messaging as opposed to directly accessing the view's members, which is an obvious OOP no-no
Cheers,
Tom Archer - Archer Consulting Group
"Eat your brussel sprouts, Junior. There are starving Chinese children American programmers that would kill for that food!"
|
|
|
|
|
Hi
I want to read an Excel File from my C++ component without using
MFC.It is v. easy doing from VB. I create a ref. to MS Excel 10.0
object library and use the workbook.
Please let me know how to achieve the same using C++.
Thanks,
Radix
|
|
|
|
|
AnuradhaCpp wrote:
I create a ref. to MS Excel 10.0
object library and use the workbook.
You can do the same with C++. See the MSDN article Q178749 for an example.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am writing a project of ListView . I want to show the Application's Icon in
the Local disk when the ListView initializing.
Although I use the follow way:
CImageList m_img;
SHFILEINFO sfi;
::SHGetFileInfo(_T("C:\Program file\"),//I want to read all the
//Application's ICON under the directory
FILE_ATTRIBUTE_NORMAL,
&sfi,
sizeof(sfi),
SHGFI_DISPLAYNAME | SHGFI_ICON);
m_img.create(32,32,TRUE | COLOR8,1,100);
m_img.Add(sfi.hIcon);
GetListCtrl().SetImageList(&m_img);
but I wonder that why the ListView can not show the Application's icon?
Do you know this is why?
Can you tell me if you me ?
Or Give me a example if you have similar project.
Thank you very much!
|
|
|
|
|
Hi.
A piece of software I have been working on relies on the locking and unlocking of 1 byte inside a specified file, from within a thread that is controlled via mutexes.
The problem I am having is intermittent. Occasionally while the following code is called:
TRY
{
m_File.Flush ();
m_File.UnlockRange ( LOCK_BYTE, 1);
}
CATCH (CFileException, e)
{
e->ReportError ();
e->Delete ();
}
END_CATCH
An exception is returned and the exception puts up on the screen "An unknown error occured while accessing an unnamed file" and in the output window "CFile exception: generic, File Unknown, OS error information = 158".
Looking at the values in the CFile object, everything looks fine. Valid handle and valid values in the variables.
Just wondering if anyone has some clue on where to look, what to look for, or even how to fix. Any ideas are welcomed as deadline is fast approaching.
|
|
|
|
|
I am not interested in writing an application which send a hello world program to the users on internet.
If you guys have ever heard of computer worm , then this is my point.I just want to work on the issue of spreading a worm with the payload in the form of a message box , take a not, message box containing a message "HELLO".You guys tell me how and what should be done or any reference of website of anypiece of code which you can refer which tells or helps me in the reproduction process of worm.
Desparately seeking help.
|
|
|
|
|
You want us to help you write a worm ? Brilliant.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
You want us to help you write a worm ? Brilliant.
Plus He is putting his Query about making virus On LEGAL MS partner Site!
This guy got lot of Guts!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
Michael Dunn wrote:
To quote Gorilla Monsoon: More guts than brains
What About Stone Cold Steve Austin!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I being a student of Bachelor of computer sciences has got the project of working on the spreading mechanism of computer worm.My aim is to understand the spreading mechanism and not to do and harm and i do mean it.So if anyone can please guide and help me , i would be much grateful.
Regards.
|
|
|
|