|
Thanks so much for this Holger, that was very kind of you.
|
|
|
|
|
Is there any reason for which you prefer RemoveAll/Append/FreeExtra over CStringArray::Copy?
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
No, i have just not recognized that there exists a copy method .
Best regards
Holger Persch
|
|
|
|
|
I am trying to use PreTranslateMessage to translate a key press into a button click message. This is the code but it aint working:
<br />
BOOL CMScaleDlg::PreTranslateMessage(MSG* pMsg)<br />
{<br />
if (pMsg->message == WM_KEYDOWN)<br />
{<br />
if (pMsg->wParam == VK_F2)<br />
{<br />
pMsg->message = WM_COMMAND;<br />
pMsg->wParam = BN_CLICKED;<br />
pMsg->lParam = (LPARAM) ::GetDlgItem(GetSafeHwnd(), IDC_BUTTON1);<br />
}<br />
}<br />
return CDialog::PreTranslateMessage(pMsg);<br />
}<br />
The code which modifies the pMsg is being executed but nothing happens.
|
|
|
|
|
try:
pMsg->wParam = MAKEWPARAM(IDC_BUTTON1, BN_CLICKED);
When you send a WM_COMMAND message, the wParam variable contains 2 pieces of information, the notification code (BN_CLICKED ) in the HIWORD , and the control's ID in the LOWORD .
HTH
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Still not working. I tried a different method using PostMessage and this worked:
<br />
if (pMsg->wParam == VK_F2)<br />
{<br />
PostMessage(WM_COMMAND, <br />
MAKEWPARAM(IDC_BUTTON1, BN_CLICKED), <br />
(LPARAM) ::GetDlgItem(GetSafeHwnd(), IDC_BUTTON1));<br />
return true;<br />
<br />
}<br />
I can use this method, it seems to work ok, but I am curious why modifying the pMsg parameter doesn;t seem to work.
|
|
|
|
|
MFC has this warning all around the docs:Note This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function. meaning it will ignore the message and parameters you give it, and instead read the original message from a cache somewhere.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
hello!
my cstring looks like that:
1;2;3;.....and so on.
i want to know, how i can delete the ';' inside this string.
is there a possibility to reset the ';' into a blank (' ')?
MFC
|
|
|
|
|
Doesn't CString have a Replace function that does this ?
<Edit> I asked because I wasn't sure. Yes, it does have a Replace method, which will do what you want. </Edit>
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
super, thanks.
where did I have my eyes?
do u know also, how can delete the ';' without a replace?
MFC
|
|
|
|
|
Just replace them with an empty string.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
i tried it, with
str.Replace(';', '');
but then i got an error message, because of the empty string.
is there another possibility?
|
|
|
|
|
str.Remove(';');
I dunno if it works for all instances, I've just been looking up the MSDN to answer you. I don't use MFC at all anymore, not for a long time.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
it functions!
thank you very much!
MFC
p.s.: i never find what i´m looking for in the msdn.
|
|
|
|
|
If i draw one from the toolbox, my application won't start, it exits right after starting. And if i try to create one with CreateWindowEx and PROGRESS_CLASS as classname like msdn does, it says it's an invalid class, how do i do it?
thanks!
|
|
|
|
|
What do you mean "a progressbar in my application?" do you want a visible progress bar in the status bar? I believe there are classes in the MFC sections that feature progress bars that are built right into the status bar.
Kuphryn
|
|
|
|
|
You need to call InitCommonControls() before creating the progress bar.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
hey there.. i am calling SetScrollPos() then calling UpdateWindow() in my CFormView derived class.. this causes a bunch of flicker in comparison to when you just use the scrollbar, but if i leave out the UpdateWindow() call then all it does is adjust the scrollbar and not move the view with it..
what command should i be calling besides UpdateWindow() ? TIA!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Flicker free drawing is such a pain in the a$$...
There are lots of ways to reduce or remove flicker, but each works under certain circumstances...
I don't understand why your calling SetScrollPos() and then UpdateWindow() ...instead of letting default scrolling to occur...?
You have a CFormView, so i'll assume you have dialog controls on the form and these controls are what are flickering...??
in your dialog resource try checking WS_CLIPCHILDREN , this will prevent your controls from flickering...
HTH
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
its a view i have that is displaying metafiles and text.. the default scrolling still works, but i have implemented a dragging hand for the view.. so im using SetScrollPos() to move the view when they drag it up/down. the dragging view works great, just has lots of flicker.. i have tried double buffering it, but that doesnt fix it.. the UpdateWindow() call is causing all the flicker..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Have you tried Keith Rules CMemDC class...if your drawing everything inside one function like OnDraw()
the his simple little class is all you should need...
Just remember to either make your background NULL or return false inside OnEraseBkgnd()
Did this work...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
i tried implementing double buffering with memdc, but it kept drawing the screen black.. however i was already overriding OnEraseBkgnd(), and i didnt think to look at that.. ill prolly try the double buffering again.. thanks for the suggestions!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
I'm having problems reading the proper EventID when reading the eventlog. Most of the Microsoft generated EventID's are OK, but some sources like Diskeeper will display as "1034662352" instead of "12" from the EventViewer.
Any ideas?
Here's a snippet of code that should give you an idea of what I'm doing...
pevlr = (EVENTLOGRECORD *) &bBuffer;
while (ReadEventLog(h, // event log handle
EVENTLOG_BACKWARDS_READ | // reads forward
EVENTLOG_SEQUENTIAL_READ, // sequential read
0, // ignored for sequential reads
pevlr, // pointer to buffer
BUFFER_SIZE, // size of buffer
&dwRead, // number of bytes read
&dwNeeded)) // bytes in next record
{
while (dwRead > 0)
{
printf("EventID: %d\n", pevlr->EventID);
}
pevlr = (EVENTLOGRECORD *) &bBuffer;
}
|
|
|
|
|
I have a database file that I want to delete if it already exists, so that I can create a new one with my code. I will have the path to the existing database available. How can I code so that it deletes the database if it exists?
Appreciate your help,
ns
|
|
|
|
|
use
BOOL DeleteFile(
LPCTSTR lpFileName
);
|
|
|
|