|
Hello all,
I have a strange problem relating to ISupportErrorInfo. I have a component implemented as a collection class. This class is created as an MTS component and I added the _NewEnum, Item and Count properties to it, so I can use it as a collection. This all goes well. But now I added the ISupportErrorInfo interface. When something doesn't go as I want I do
[ccode]
return Error( L"My Message", IID_IMyInterface, E_FAIL);
[/ccode]
so I can see the error in a VB client with the Err object. But strange thing is that this only works with late binding, not with early binding. So if I declare a variable with
[ccode]
Dim obj as OBject
[/ccode]
I can see the error with err.description, but when I declare it with
[ccode]
Dim Obj as MyInterface
[/ccode]
it doesn't work that way and the Err.description simply tells me that "method 'SomeMethod' of component 'MyInterface' fails"!!!!!
Anybody has a clue what I could have done wrong? I use NT ws4 sp6 and VS6 sp3
TIA
Henk
|
|
|
|
|
Hi!
I've tried to create a simple ATL object using VC6 wizard, which supports ISupportErrorInfo. Then I added the method, which returns an error the same way as you, and then I tried both ways of using the object in VB - no any problems!
You can follow my steps and try to create a simple object and then test it...
Regards,
Alex Gorev,
Dundas Software.
==================
The original message was:
Hello all,
I have a strange problem relating to ISupportErrorInfo. I have a component implemented as a collection class. This class is created as an MTS component and I added the _NewEnum, Item and Count properties to it, so I can use it as a collection. This all goes well. But now I added the ISupportErrorInfo interface. When something doesn't go as I want I do [ccode] return Error( L"My Message", IID_IMyInterface, E_FAIL); [/ccode] so I can see the error in a VB client with the Err object. But strange thing is that this only works with late binding, not with early binding. So if I declare a variable with [ccode] Dim obj as OBject [/ccode] I can see the error with err.description, but when I declare it with [ccode] Dim Obj as MyInterface [/ccode] it doesn't work that way and the Err.description simply tells me that "method 'SomeMethod' of component 'MyInterface' fails"!!!!!
Anybody has a clue what I could have done wrong? I use NT ws4 sp6 and VS6 sp3
TIA Henk
|
|
|
|
|
Merry Christmas,
Hi, a I have a Dialog Based application. The default window class is #32770 (Dialog).
I have tried to handle the PreCreateWindow and CreateWindow virtual functions, but they are never called.
Do anybody know what is the problem?
Thank You
Alejandro Calvo
|
|
|
|
|
These functions never called in MFC-based dialog. If you will see at source, you can see these calls does not exists. That's because there are no reasons to do it. You can change your dialog styles in editor
==================
The original message was:
Merry Christmas,
Hi, a I have a Dialog Based application. The default window class is #32770 (Dialog). I have tried to handle the PreCreateWindow and CreateWindow virtual functions, but they are never called. Do anybody know what is the problem? Thank You Alejandro Calvo
|
|
|
|
|
Thank You,
But I need to changed the Class name.
Any Suggestions?
Alejandro Calvo
==================
The original message was:
These functions never called in MFC-based dialog. If you will see at source, you can see these calls does not exists. That's because there are no reasons to do it. You can change your dialog styles in editor
================== The original message was: Merry Christmas,
Hi, a I have a Dialog Based application. The default window class is #32770 (Dialog). I have tried to handle the PreCreateWindow and CreateWindow virtual functions, but they are never called. Do anybody know what is the problem? Thank You Alejandro Calvo
|
|
|
|
|
Hi Alejandro,
Here's how to change the class name in a dialog-based MFC app. There are two things you have to do:
1) register the new class name in InitApplication;
and 2) use the same class name in your .rc dialog template. See below for an example taken from a working MFC app. Good luck!
In your CWinApp file:
BOOL CApp::InitApplication()
{
WNDCLASS wc;
wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
wc.lpfnWndProc = DefDlgProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = AfxGetInstanceHandle();
wc.hIcon = LoadIcon(IDR_MAINFRAME);
wc.hCursor = ::LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)COLOR_WINDOW + 1;
wc.lpszMenuName = NULL;
wc.lpszClassName = "MyClass";
::RegisterClass(&wc);
return CWinApp::InitApplication();
}
In your .rc file:
IDD_MY_DIALOG DIALOGEX 0, 0, 292, 167
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "My Excellent Dialog"
MENU IDR_MENU
CLASS "MyClass"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "", IDC_SHEET, "Static", SS_BLACKFRAME, 5,7,234,142
CONTROL "Go", IDC_PROCESS, "Button", BS_OWNERDRAW | WS_DISABLED |
WS_TABSTOP, 248,8,42,20
PUSHBUTTON " Use\nMRU File", IDC_USEMRUFILE, 248,32,42,20, BS_CENTER |
BS_MULTILINE | WS_DISABLED
PUSHBUTTON "Exit",IDC_EXIT,248,128,42,20
LTEXT "Ready", IDC_STATUSBAR, 5,153,284,12, SS_CENTERIMAGE
END
|
|
|
|
|
Hi Tom,
Thank You, That works really fine.
Alejandro Calvo
==================
The original message was:
Hi Alejandro,
Here's how to change the class name in a dialog-based MFC app. There are two things you have to do: 1) register the new class name in InitApplication; and 2) use the same class name in your .rc dialog template. See below for an example taken from a working MFC app. Good luck!
In your CWinApp file:
BOOL CApp::InitApplication() { WNDCLASS wc; wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW; wc.lpfnWndProc = DefDlgProc; wc.cbClsExtra = 0; wc.cbWndExtra = DLGWINDOWEXTRA; wc.hInstance = AfxGetInstanceHandle(); wc.hIcon = LoadIcon(IDR_MAINFRAME); wc.hCursor = ::LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)COLOR_WINDOW + 1; wc.lpszMenuName = NULL; wc.lpszClassName = "MyClass"; ::RegisterClass(&wc); return CWinApp::InitApplication(); }
In your .rc file:
IDD_MY_DIALOG DIALOGEX 0, 0, 292, 167 STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES CAPTION "My Excellent Dialog" MENU IDR_MENU CLASS "MyClass" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN CONTROL "", IDC_SHEET, "Static", SS_BLACKFRAME, 5,7,234,142 CONTROL "Go", IDC_PROCESS, "Button", BS_OWNERDRAW | WS_DISABLED | WS_TABSTOP, 248,8,42,20 PUSHBUTTON " Use\nMRU File", IDC_USEMRUFILE, 248,32,42,20, BS_CENTER | BS_MULTILINE | WS_DISABLED PUSHBUTTON "Exit",IDC_EXIT,248,128,42,20 LTEXT "Ready", IDC_STATUSBAR, 5,153,284,12, SS_CENTERIMAGE END
|
|
|
|
|
Hello
I need the table convert color string to RGB in HTML
such as white => 0xffffff
black => 0x000000
......
Thanks
|
|
|
|
|
Hello
I have some problem about font size. I create font like this
int m_Size=18; // point size convert to logical size
int LogicalInch=pDC->GetDeviceCaps(LOGPIXELSY);
int DeviceUnits=::MulDiv(m_Size,LogicalInch,72);
m_font.CreateFont(DeviceUnits,0,0,0,
m_bold,m_italic,m_underline,m_strike,
DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_CHARACTER_PRECIS,
DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,
"Cordia New");
pDC->SelectObject(&m_font);
pDC->TextOut(10,10,"Hello world");
When display text I've found that it doesn't show correct size ( smaller than )
compare with Netscape.
What's wrong ?????
Thanks
|
|
|
|
|
Hi!
You can try to specify the font height as a negative number, in this case you define the character height not the cell height as in your case. See CreateFont() function for more details.
Regards,
Alex Gorev,
Dundas Software.
==================
The original message was:
Hello I have some problem about font size. I create font like this
int m_Size=18; // point size convert to logical size int LogicalInch=pDC->GetDeviceCaps(LOGPIXELSY); int DeviceUnits=::MulDiv(m_Size,LogicalInch,72); m_font.CreateFont(DeviceUnits,0,0,0, m_bold,m_italic,m_underline,m_strike, DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE, "Cordia New"); pDC->SelectObject(&m_font); pDC->TextOut(10,10,"Hello world");
When display text I've found that it doesn't show correct size ( smaller than ) compare with Netscape.
What's wrong ?????
Thanks
|
|
|
|
|
Hi,
Try to use CreatePointFont(180,"Cordia New");
Regards,
Andrei Zenkovitch
Dundas Software
==================
The original message was:
Hello I have some problem about font size. I create font like this
int m_Size=18; // point size convert to logical size int LogicalInch=pDC->GetDeviceCaps(LOGPIXELSY); int DeviceUnits=::MulDiv(m_Size,LogicalInch,72); m_font.CreateFont(DeviceUnits,0,0,0, m_bold,m_italic,m_underline,m_strike, DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE, "Cordia New"); pDC->SelectObject(&m_font); pDC->TextOut(10,10,"Hello world");
When display text I've found that it doesn't show correct size ( smaller than ) compare with Netscape.
What's wrong ?????
Thanks
|
|
|
|
|
Hi Kobe,
Here are two routines that I use. Note the use of
the "DISPLAY" device to get the hdc. Good luck!
/////////////////////////////////////////////////////////////
// GetFontPointSize()
int GetFontPointSize(int nHeight)
{
HDC hdc = ::CreateDC("DISPLAY", NULL, NULL, NULL);
ASSERT(hdc);
int cyPixelsPerInch = ::GetDeviceCaps(hdc, LOGPIXELSY);
::DeleteDC(hdc);
int nPointSize = MulDiv(nHeight, 72, cyPixelsPerInch);
if (nPointSize < 0)
nPointSize = -nPointSize;
return nPointSize;
}
////////////////////////////////////////////////////////////////
// GetFontHeight()
int GetFontHeight(int nPointSize)
{
HDC hdc = ::CreateDC("DISPLAY", NULL, NULL, NULL);
ASSERT(hdc);
int cyPixelsPerInch = ::GetDeviceCaps(hdc, LOGPIXELSY);
::DeleteDC(hdc);
int nHeight = -MulDiv(nPointSize, cyPixelsPerInch, 72);
return nHeight;
}
|
|
|
|
|
I’ve been reading your submission on registerwindowmessage at the codeguru.com web site.
Your information in addition to some other sources, sure seems simple enough. The only problem is I just can not get it to work.
This is what I have done. Can you suggest where I am going wrong? Maybe it is the way I send the message?
I want to send a message from one dialog-based exe to another.
Both exe’s have this message defined.
#define TESTMSG "TESTMSG"
Both exe’s get the message id like this, and the debugger shows both get the same value.
int gnStartMsg = RegisterWindowMessage(TESTMSG);
The sending exe then sends a message like this.
SendMessage(gnStartMsg, 0, 0);
The receiving exe has this message map and member function.
BEGIN_MESSAGE_MAP(CRegToDlg, CDialog)
//{{AFX_MSG_MAP(CRegToDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_REGISTERED_MESSAGE(gnStartMsg, OnMsgTest)
void CRegToDlg::OnMsgTest()
{
AfxMessageBox("I made it");
}
The messagebox is never displayed.
PMCGA61201@AOL.COM
Thank you.
|
|
|
|
|
Check thar you made entry in .h file.
afx_msg LRESULT yourfunction(WPARAM wParam,LPARAM lParam);
and your .cpp file
static int gnStartMsg=.......
LRESULT yourclass::yourfunction(WPARAM wParam,LPARAM lParam)
hope this helps;
sadhu
==================
The original message was:
I’ve been reading your submission on registerwindowmessage at the codeguru.com web site.
Your information in addition to some other sources, sure seems simple enough. The only problem is I just can not get it to work.
This is what I have done. Can you suggest where I am going wrong? Maybe it is the way I send the message?
I want to send a message from one dialog-based exe to another.
Both exe’s have this message defined.
#define TESTMSG "TESTMSG"
Both exe’s get the message id like this, and the debugger shows both get the same value.
int gnStartMsg = RegisterWindowMessage(TESTMSG);
The sending exe then sends a message like this.
SendMessage(gnStartMsg, 0, 0);
The receiving exe has this message map and member function.
BEGIN_MESSAGE_MAP(CRegToDlg, CDialog) //{{AFX_MSG_MAP(CRegToDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP ON_REGISTERED_MESSAGE(gnStartMsg, OnMsgTest)
void CRegToDlg::OnMsgTest() { AfxMessageBox("I made it"); }
The messagebox is never displayed. PMCGA61201@AOL.COM Thank you.
|
|
|
|
|
The problem is this line:
SendMessage(gnStartMsg, 0, 0);
This sends the message right back to the CDialog that this code is in. You want to do:
::SendMessage ( hwndOtherDlg, gnStartMsg, 0, 0 );
where hwndOtherDlg is the HWND of the receiving dialog. Or, if you have a CWnd* to it, you can do:
pOtherDlg->SendMessage ( gnStartMsg, 0, 0 );
|
|
|
|
|
I want to create an app that runs in the background most of the time. On rare occasions I want to display a modeless dialog for a short amount of time and then dismiss the dialog. This all seems easy enough to do.
I would like some advice on how to place the focus back on the app or control that had focus before my dialog interrupted it.
Any high level suggestion would be helpful.
Thank you.
PMCGAHAN@UCSWORKS.COM
|
|
|
|
|
If you haven't switched to any other windows, then it'll happen automatically when the dialog box is closed. That's the way Windows works and I advice that you let it work that way.
If you want to override that behavior then before showing the dialog box, get the handle of the foreground window (using GetForegroundWindow) and then restore it when the dialog closes (SetForegroundWindow).
Cheers!
Alvaro
|
|
|
|
|
Hello
I implement my own web browser. I have to know how to send
data with method POST ???
because of method GET I can check the attribute of user and
attach it with URL
such as
http://discussions.earthweb.com/cgi-bin/dnewsweb?cmd=post
&group=earthweb.cgi.general&utag=
but in method POST URL doesn't show any infomation
I don't know what to do
Please help me ..... ( I'm sorry to post unrelate VC++ )
Thank you
|
|
|
|
|
Post Method depends on the reques header "Content-Length:"
to determine when is the data finished.
here is a telnet session to demonstrate how you may try it (After getting connected e.g. 127.0.0.1 port 80
==================
The original message was:
Hello I implement my own web browser. I have to know how to send data with method POST ??? because of method GET I can check the attribute of user and attach it with URL
such as http://discussions.earthweb.com/cgi-bin/dnewsweb?cmd=post &group=earthweb.cgi.general&utag=
but in method POST URL doesn't show any infomation I don't know what to do
Please help me ..... ( I'm sorry to post unrelate VC++ )
Thank you
|
|
|
|
|
Post Method depends on the request header "Content-Length:"
to determine when is the data finished.
here is a telnet session to demonstrate how you may try it (After getting connected e.g. 127.0.0.1 port 80
POST /testDirectory/Form.asp HTTP/1.0
HOST: MyComputer and so on
Content-Length: (this will be the number of characters you are sending in the data portion )
<empty line="">
The Data which is the what usually follows the question mark (Note you don't need the question mark any more)
HTH
Regards
Ghazi Wadi
Dundas Software
==================
The original message was:
Hello I implement my own web browser. I have to know how to send data with method POST ??? because of method GET I can check the attribute of user and attach it with URL
such as http://discussions.earthweb.com/cgi-bin/dnewsweb?cmd=post &group=earthweb.cgi.general&utag=
but in method POST URL doesn't show any infomation I don't know what to do
Please help me ..... ( I'm sorry to post unrelate VC++ )
Thank you
|
|
|
|
|
Hello Ghazi
Would you mind give me an example please ....
cos I'm very new in CGI.
Thank you very much
|
|
|
|
|
The POST messages are sent by the Web Server as part of the applications environment variables. So you would use
routines like getenv to retrieve these variables.
Rajiv
|
|
|
|
|
Hello
I have to know that file .gif is animated or not !!!
because my library display Gif not support Animated
Gif it will crash when open Animated.
My idea is do check myself that is Animated or not !!!
but I don't know what to do ???
Any Idea ???
Thank you
|
|
|
|
|
Hi,
You can find descriptions of the GIF file format here:
http://www.wotsit.org/ (Graphics section)
Maybe you should first check if a new version of that library is available
(or maybe get another one
Cheers,
Cristi
|
|
|
|
|
If you know how to parse the header section of the GIF file, then look for the 0xFF flag indicating an application-specific extension, and if found and you have a buffer, check for the string "NETSCAPE2.0" -- that's the indication for an animated GIF.
==================
The original message was:
Hello I have to know that file .gif is animated or not !!! because my library display Gif not support Animated Gif it will crash when open Animated. My idea is do check myself that is Animated or not !!! but I don't know what to do ??? Any Idea ???
Thank you
|
|
|
|
|