|
do you get the same error with other wininet functions, like say InternetOpen, or only with that function?
.... If its only with InternetGetConnectedState then try InternetGetConnectedStateEx... it might have been deprecated without warning in VC7 or somethin
|
|
|
|
|
Hi all,
I have a problem. I have written a program that uses a commercial activeX component. I need to distribute this program on other machines and in order to do that I need to also distribute the commercial .ocx file and register it.
This is no problem.
What I want to do is for my program to send a popup error message if the ocx file is not installed/registered with windows.
Currently it just crashes.
thanks
---
|
|
|
|
|
why not do a cocreateinstance and catch any errors/exceptions
Bryce
|
|
|
|
|
It crashes at
TRY {<br />
CModelessMain::Create(...)<br />
}<br />
CATCH_ALL<br />
{<br />
<t>...<br />
}<br />
END_CATCH_ALL<br />
Never tried CoCreateInstance - will give it a go
---
|
|
|
|
|
Create() method returns a BOOL , If you have specified appropriate parameters, the method does not crash. So better check for your parameters. In case the control is not registered, Create returns a FALSE . In this case, give user the message that control is not registered or installed.
@!$h@
|
|
|
|
|
bryce wrote:
why not do a cocreateinstance and catch any errors/exceptions
Ok How do I do that????
---
|
|
|
|
|
You can create an object of your control using COM techniques:
HRESULT hr = CoCreateInstance(<br />
CLSID_YourControlID, <br />
NULL, <br />
CLSCTX_INPROC_SERVER, <br />
IID_IYourControlInterface, <br />
(void**)&pInterfaceName);<br />
<br />
if (FAILED(hr)) {<br />
MessageBox(<br />
NULL, "Failed to create instance of " "Your Control", "Error!", MB_ICONERROR);<br />
}
For that you need to know the basics of COM. MSDN is a good source of learning so read about the basics of COM.
All the best!!
@!$h@
|
|
|
|
|
I had found on MSDN its said that, SetDIBitsToDevice can be pass JPEG image as source image.
Anyone, Could you show me the code to show JPEG image by using SetDIBitsToDevice .
|
|
|
|
|
I am seeing some strange running behavior, when building a library using C++ <iostream> and some other library using C <stdio.h>. The building results in some of the stdio.h symbols being defined twice. And the running behavior is that file reads with fstream.getline end up sucking in the newline character, which it is not suppose to do.
At this point I am thinking that the symbols for the old C libraries are getting used instead of the newer C++ versions, and I am betting that they are incompatible.
Both libraries are outside my control. I am integrating them into an application. Otherwise I would just update the headers to use the C++ versions. I have a vague recollection that there was a header file or some #define to make the two play together nicely, but can't seem to find it. Does anyone know of such a header, #define, or some other flag or trick to make these libraries work together?
Thanks.
Dave Hickerson
david.a.hickerson@boeing.com
|
|
|
|
|
I found that one of the libraries had set Unix file reading format. This is caused carriage returns to end up in the fstream.getline() read. How annoying.
I did find a MS VC++ 6.0 error with getline() in the string header referenced at Microsoft: http://support.microsoft.com/default.aspx?scid=kb;en-us;240015 . This one is a manual entry to the <string> header file. If you are using MS VC++ .NET, its fixed in that version according to the bug report.
Dave
Dave Hickerson
david.a.hickerson@boeing.com
|
|
|
|
|
Hi,
How do you update the main frame if the user presses an accelerator key and a dialog box is active? For example, given F1 is "Help" and a dialog box is active, how do you update main frame so that it can handle "F1" accelerator accordingly?
I have tried overriding PreTranslateMessage() and processing LoadAccelerators() using main frame's handle.
::TranslateAccelerator(AfxGetMainWnd()->GetSafeHandle(), hAccelerator, pMsg);
The solution above does solve this problem, but it creates a new problem. No other key works in the dialog box such as "paste" or "copy."
I want to update main frame upon an accelerator key even when a dialog box is active.
Thanks,
Kuphryn
|
|
|
|
|
I'm using a MFC Edit Control to log information for my app. Unfortunately, I can't get it to automatically scroll to the bottom whenever I add more text! I've tried LineScroll, but that doesn't do anything, no matter what parameters I use.
|
|
|
|
|
CEdit edit_control;
edit_control.SetSel(0,-1,FALSE); This will force the edit control to scroll the last line into view whenever you add more text.
You need to be a little careful in how you use this. Each time you do this, you'll scroll the control down, even if the user was trying to scroll the control himself. A simple solution is to have a check box off to the side, perhaps labelled "update". If the update box is checked, you scroll the last line into place. If it's not checked, assume that the user is looking at the data, and doesn't want the scrolling to happen. You can still update the text in the edit control in this case, although you may need to make sure you save the user's selection (GetSel() and SetSel()) and restore it after you update the text.
Software Zen: delete this;
|
|
|
|
|
It doesn't work
You can see my app here, if seeing the edit control in action might help: http://www.lancersreactor.com/t/download/download.asp?id=123
|
|
|
|
|
Which product is the better of the two?
Jon Sagara
You know the world is off tilt, when the best rapper is a white guy, the best golfer is a black guy, the tallest basketball player is Chinese, and Germany doesn't want to go to war.
-- Charles Barkley
|
|
|
|
|
I am currently using BoundsChecker, though I have used Purify in the past (about 4 years ago on VC++ and SGI). Both are good products, though I think BoundsChecker is easier to use. If you are getting this for a company and getting multiply copies, I would think about getting one of each. Each has their strengths, one may find something the other may miss.
Dave Hickerson
david.a.hickerson@boeing.com
|
|
|
|
|
|
I tried both of them recently and BoundsChecker worked much better for me. I have a project with 120,000 lines of code and Purify generally was not able to operate correctly. It generally stops execution on some API calls, which are valid calls. Even if it works fine, the resource and error leak analysis of Purify was not as good as BoundsCheckers analysis (it was not even close to it).
Currently I am using BoundsChecker and it works like a charm. It has more features than Purify and its integration to Visual C++ is much better.
You can request a trial for both of the products. Just try and see both of them...
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
<nobr>They say I'm lazy but it takes all my time
|
|
|
|
|
I created a new class based on CButton -- CMyButton. I add a message notification handler in CMyButton.cpp for =BN_CLICKED to change an protected member variable of CMyButton.
void CMyButton::OnClicked()
{
m_nState += 1;
}
Using resource editor, I put an instance of CMyButton to my dialog template. I want my dialog to handle the BN_CLICKED also, do some other stuff.
void CMyDlg::OnMyBtn()
{
MessageBox("Button pressed.");
}
The problem is: CMyDlg::OnMyBtn is never called, even though I add the style of "Notify" to the button instance in the resource editor. What am I missing here?
TIA!
|
|
|
|
|
You need an entry in the message map for CMyDlg that 'connects' your button to the handler.
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
ON_BN_CLICKED(IDC_Control_ID, OnMyBtn)
END_MESSAGE_MAP() IDC_Control_ID is the resource ID for the button that you assigned when you created it.
To get a feel for this, use the wizard to create a simple dialog application. In the resource editor, drop a button on the dialog. In VC6, right-click on the button you just added and select Events. In VS.NET, right-click and select Add Event Handler. This lets you add code to the dialog class to handle events from the button. Take a look at the code generated by the wizard. It adds code in the following places:
- A declaration is added to
MyDlg.h for the button handler. This will be a line of the form afx_msg void OnMyButton(); - An entry is added to the message map like the example above.
- A definition of the handler is added to
MyDlg.cpp , similar to the following:
void MyDlg::OnMyButton()
{
}
Software Zen: delete this;
|
|
|
|
|
yes, I already had it. It seemed to me that the BN_CLICKED is processed by the button itself and the message never get to the dialog.
I add the following to CMyButton::OnClicked:
GetParent()->PostMessage(WM_COMMAND,
MAKEWPARAM(this->GetDlgCtrlID(), BN_CLICKED),
LPARAM(this->m_hWnd));
but it didn't help. Any hint?
|
|
|
|
|
May be this was discussed earlier, but is there way to have Maximized and Restored children of MDI, or prevent Restore from affecting other windows. Something like Opera & dialog popup.
Thanks,
Brian
|
|
|
|
|
Here are two code fragments.
I would like to understand what is the problem with the second one?
It is almost identical to the first one, except I wanted to use
a "pointer access". (e.g: CDlg* p_dlg; p_dlg-> . . .)
// The following code fragment works OK:
//=================================================
// this is in MainFrm.h:
#include "Dlg.h"
public:
CDlg dlg;
//----------------------------------------------------
// this is in MainFrm.cpp:
void CMainFrame::OnShowDlg()
{
dlg.Create(IDD_DLG,this);
dlg.SetWindowPos(&wndTop,10,10,20,10,SWP_SHOWWINDOW);
dlg.ShowWindow(SW_SHOW);
}
*********************
//The following code fragment compiles OK
//but the modeless window does not show:
//===========================================
// this is in MainFrm.h:
#include "Dlg.h"
public:
CDlg* p_dlg; //pointer !!
//----------------------------------------------------
// this is in MainFrm.cpp:
void CMainFrame::OnShowDlg()
{
p_dlg->Create(IDD_DLG,this);
p_dlg_SetWindowPos(&wndTop,10,10,20,10,SWP_SHOWWINDOW);
p_dlg->ShowWindow(SW_SHOW); //will NOT show!!!
Thank you:
Gabor Kalman
Kalman_G@MSN.COM
|
|
|
|
|
You need to create the C++ object before you use it:
void CMainFrame::OnShowDlg()
{
if ( NULL == p_dlg )
p_dlg = new CDlg();
p_dlg->Create( IDD_DLG, this );
// etc.
}
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
I have some views defined in the resource file.
I display these in a splitterwnd. I like to know the size of the dialog in the resource file so that I can resize the splitters according to this size.
How to?
yours sincerly
Jørgen Granborg
|
|
|
|