|
Maybe Ivo Ivanov's API hooking revealed[^] can be of help here.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
cheers Joaquín.. Im just having a quick read now
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
I'm trying to draw a button and an ip address area in my active x control.
I thought I could just use the ResourceView->Dialog to add the components visually, but evidently that only allows you to manipulate the property and about box areas for activex programs.
So... my question is how do I draw, say, a simple CButton in the ondraw area of my control?
something like:
void CAChatCtrl::ondraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
CButton testButton = new Button();
CRect bBounds = new CRect( rcBounds->r - 30, rcBounds->b - 30, rcBounds->r, rcBounds->b );
testButton::Create("DrawnButon",BS_DEFPUSHBUTTON,bBounds,?,??);
}
Thanks for any help
|
|
|
|
|
Hey there guys... Just found out that if you want to get the last error of api calls then just type:
@err,hr
into the watch window... A very useful tip i thought and saves you programaticaly calling the the GetLastError api function!
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
Hi,
I've got an app (running under Win2k) with a flexgrid control in. It works fine under an Administrator, but as a normal user we have the following:
PROBLEM - Running on machines that haven't previously had msflxgrd.ocx installed results in an "Unsupported operation" message box when we try loading the app.
We are using Installer 1.1, and have tried using the flexgrid merge module, as well as distributing msflxgrd.ocx by hand.
We have definitely tried 'regsvr32 msflxgrd.ocx' too!!!!!
I've used OLEView to look at the ocx registration details. Under and administrator, it can view all the details and expand the interface leaves fine. Under a normal user it can't get any details about the ocx. It just gives the error:
"CoGetClassObject failed.
Class not registered
REGDB_E_CLASSNOTREG ($80040154)"
On machines that already have msflxgrd.ocx, it seems to work fine.
Anyone have any ideas?
TIA,
Paul.
|
|
|
|
|
could it be that the ocx isn't getting installed properly? (i.e. the administor can read the file, but normal users can't)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Can anyone explain the process of using a CTabCtrl in a Dialog Bar. I understand the process of how tab controls work and have found away to use them in dialog boxes, but i cannot work out how to use them in a dialog bar
your help would be gratefully appreciated
thankyou
steven oliver
|
|
|
|
|
stevenoliver wrote:
cannot work out how to use them in a dialog bar
I would have thought it would be the same process as using it in a CDialog ? I admit I haven't tried using it in a CDialogBar . Were you having a specific problem?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
to get a dialog bar to work correctly you have to use the CMainFrame class and not a class of its own.
To use CtabCtlr in a normal dialog you create the tabs in WM_INITDIALOG. You cannot derive WM_INIDIALOG from CMainFrame.
I am not sure which handler to use, in this case
Is there an equivalent to WM_INITDIALOG for CMainFrame??
steven
|
|
|
|
|
Ah. You could post a custom message (IDC_INIT_TABCTRL ) to the dialog bar the first time it's shown, and initialize the tab control in the handler for IDC_INIT_TABCTRL .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
thankyou.
sorry for my ignorance, i am still fairly new to mfc. Could you possibly explain how i go about doing this?
thankyou
steven oliver
|
|
|
|
|
I think my earlier response was sorta misleading (I'm not fully awake). Just override your dialog bar's OnShowWindow() and add this logic to it (after calling the base class handler):
if (!m_bTabCtrlInitialized) {
...;
m_bTabCtrlInitialized = true;
}
m_bTabCtrlInitialized is a bool member that's initialized to false in your dialog bar's constructor.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
i also cannot create a member variable for the tab control in CMainFrame. How do i go about doing that?
thankyou
steven
|
|
|
|
|
The tab control is a member of the dialog bar, not the mainframe. The mainframe is a container window and isn't associated with a dialog resource.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Re: your email, sorry I don't have a sample of a tab ctrl in a dialog bar.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I want to get bytes sent and bytes received in windows 2000, I try to use IP Helper API GetIfEntry, but it seems that the bytes sent and bytes received data is changing slowly, and another problem is the bytes sent is equal to bytes received.
Would you please tell me how to fix this problem?
Thank you very much!
The program is as the following:
int _tmain(int argc, _TCHAR* argv[])
{
cout<<"net adapters information:"<<endl<<endl;
="" pmib_ifrow="" ifrow="new" mib_if;
="" mib_ifrow="" ifrow;
="" mib_ifrow();
="" for(int="" i="1;i<2;i++)
" {
="" ifrow-="">dwIndex=i;
DWORD dret=GetIfEntry(ifrow);
if(dret!=NO_ERROR)
{
//cout<<"error index="<
|
|
|
|
|
|
*hic*
Roger Allen
Sonork 100.10016
I have a terminal disease. Its called life!
|
|
|
|
|
The Programme FTPWander(http://www.codeproject.com/internet/ftpwanderer.asp)
implement the transmission using WININET API.But as MSDN issued, CInternetFile don't Support CInternetFile::Seek(..)
for FTP File, then I just don't know how to implement resuming interrpted transmission when using WININET API.
thanks for any ideas
|
|
|
|
|
I had developed a service that run under win2k, this service uses those functions in order to prevent the user to use the keys involved, but for my surprise it only works in some computers...
The fact is that I cannot use it in an industrial PC as I would do in a normal home PC.
take a look at those functions:
<br />
<br />
DLLSCT_API bool bActivarHook(bool bActivar )<br />
{<br />
if(bActivar == true)<br />
{<br />
hHookTeclat = SetWindowsHookEx(WH_KEYBOARD_LL, HookTeclatLL, hInstDLLSCT, NULL);<br />
return (hHookTeclat != NULL);<br />
}<br />
else<br />
{<br />
if(hHookTeclat != NULL)<br />
{<br />
UnhookWindowsHookEx(hHookTeclat);<br />
return true;<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}<br />
}<br />
<br />
<br />
static LRESULT CALLBACK HookTeclatLL(int nCode,WPARAM wParam,LPARAM lParam)<br />
{<br />
if (nCode == HC_ACTION)<br />
{<br />
switch (nCode)<br />
{<br />
case WM_KEYDOWN:<br />
case WM_SYSKEYDOWN:<br />
case WM_KEYUP:<br />
case WM_SYSKEYUP:<br />
{<br />
LPKBDLLHOOKSTRUCT p = (LPKBDLLHOOKSTRUCT)lParam;<br />
bool bEliminarPressioTecla = false;<br />
<br />
if ((p->flags & LLKHF_ALTDOWN) != 0)<br />
{<br />
bEliminarPressioTecla = (p->vkCode == VK_TAB) || <br />
(p->vkCode == VK_ESCAPE) ||<br />
(p->vkCode == VK_F4) ||<br />
(p->vkCode == VK_LWIN) ||<br />
(p->vkCode == VK_RWIN);<br />
}<br />
else if ((GetKeyState(VK_CONTROL) & 0x8000) != 0)<br />
{<br />
bEliminarPressioTecla = (p->vkCode == VK_ESCAPE) || <br />
(p->vkCode == VK_F4) ||<br />
(p->vkCode == VK_LWIN) ||<br />
(p->vkCode == VK_RWIN);<br />
}<br />
else<br />
{<br />
bEliminarPressioTecla = (p->vkCode == VK_LWIN) ||<br />
(p->vkCode == VK_RWIN) ||<br />
(p->vkCode == VK_ESCAPE);<br />
}<br />
<br />
if (bEliminarPressioTecla) <br />
{<br />
return 1;<br />
}<br />
<br />
break;<br />
}<br />
}<br />
}<br />
<br />
return CallNextHookEx(hHookTeclat, nCode, wParam, lParam);<br />
}<br />
when I start windows by default I start that service automatically.
but it don't prevent those keystrokes in the industrial PC that I'm using now...
I will contact my supplier in order to know which differences are between that industrial PC and the "normal" ones, but as far as I can see the only difference is that it need to be configured as an american keyboard...
Is there any way in which I can see which key is being pressed, or somewhere where I can find information related (keyscan codes...)
As always thank you very much...
|
|
|
|
|
i have buy many books about MFC.. but i can't find helpFULL information in them ...
maybe somebody knows any GOOD links/ttorials about MDI framework programming,
what i can simply download them and study at home ... !?!?
PS: it's better if it wont be about document/view ....
PPS : it is not enoughtwith examples on codeguru codeproject :P
PPPS: sory for my ENG...
----------------------------
never stop coding.
|
|
|
|
|
I use the T2CA() macro to convert a string (UNICODE or non UNICODE - the code should work with both systems) to a char* string (each character = 1 byte) to save it to a file.
The code looks like:
...
USES_CONVERSION;
DWORD dwWrittenBytes;
if (!WriteFile(m_hFile, T2CA((LPCTSTR) str), str.GetLength(), &dwWrittenBytes, NULL) ||
dwWrittenBytes != (DWORD) str.GetLength())
{
...
}
...
The problem is that when I have a string like "Büro" (a german word), the T2CA() macro removes the "ü" in the string and saves the string "Bro" to the file!
So, how can I convert a string (UNICODE / non UNICODE) to a char* without removing some characters (like ü,ö,...)?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
The following works just fine for me:
#include <atlbase.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(void)
{
USES_CONVERSION;
ofstream ofs("out.txt");
ofs<<W2CA(L"Büro")<<endl;
return 0;
} Maybe the problem is in the third parameter of the call to WriteFile . Shouldn't it be str.GetLength()*sizeof(TCHAR) ?
Correction: This is obviously not the problem, since you're writing ANSI strings.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Correction: This is obviously not the problem, since you're writing ANSI strings.
Yes! This is not the problem! It's just a problem of the conversion (UNICODE -> ANSI)!
Please take a look on my reply to the message of Maximilien Re: UNICODE problem!.
Thanks!!!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Why can't you just save the UNICODE string ? why the conversion ? WriteFile writes a void buffer, just just need to set the lenght correctly ( as stated by the other poster )
Max.
|
|
|
|