|
You guys comments gave me a lot of helps!!!!!!!!!!!!!!!!!!
Thankssssssssssssssssssssssssss
|
|
|
|
|
If I have the following code on VB:
Dim myObj as Object
Set myObj = CreateObject("MyDCOMServer.MyClass", "ServerName")
How do I do it on Visual C++?
Thanks a lot,
Julian
|
|
|
|
|
Use this.
HRESULT CoCreateInstanceEx(
REFCLSID rclsid, //CLSID of the object to be created
IUnknown *punkOuter, //the controlling IUnknown
DWORD dwClsCtx, //CLSCTX values
COSERVERINFO *pServerInfo,//Machine on which the object is to be instantiated
ULONG cmq, //Number of MULTI_QI structures in pResults
MULTI_QI *pResults //Array of MULTI_QI structures
);
Cheers,
Anand
|
|
|
|
|
BoundsChecker is giving me the following report for hundreds of occurances within my MFC application.
----
Memory leak
64 bytes allocated by CObject::operator new in wincore.cpp (3941), HANDLE: 0x01C03410
Location of Error
CTempWnd::CreateObject wincore.cpp 3941
The offending function is IMPLEMENT_DYNCREATE which is of course throughout the entire applcation. Is BoundsChecker just wrong here, or is there some cleanup method that I can't seem to find?
Any help appreciated!
A cubicle is just a padded cell without a door.
|
|
|
|
|
Boundschecker is sometimes wrong, and I believe a lot of the 'leaks' in MFC occur on shutdown, when the whole lot of memory is freed anyhow.
Nothing you can do I reckon. You should see all the MFC leaks it gave me when testing a paint program.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Yeah, I turned the MFC suppression stuff on, but this one was the only one that still showed up, and was a significant amount. Most everything else was a one time leak.
It's wrong in some of my stuff as well, I've set a breakpoint on the line where the free or delete happens, seen it execute, written down the memory location and seen BC report it as a leak. Overall it's a great tool, but sometimes it's a little flaky. It seems to be worse with older C code that does malloc/free calls than with new/delete...
Thanks!
Everytime I think I've hit the bottom, someone lends me a shovel.
|
|
|
|
|
Hey there, i know this may sound simple to some but i need some help on getting a string from a text box to a list box. You see i have a button that when pressed, i need to add the value string of the textbox to the listbox. Can someone please help me. Thanx
|
|
|
|
|
this should help, although I have not run it though complier
CString stText;
GetDlgItemText(ID_MYTEXTBOX, stText);
m_lstBox.AddString(stText);
Mike
|
|
|
|
|
Are there any optimization options (or compiler switches) that would decrease amount of memory required by Release build of MFC apps?
I know that memory consumption should be the least concern in these days, but I have small SystemTray app., and it eats quite a bit of RAM. The answer to my problem is to *not* use MFC to write SystemTray application, but writing in C++, would seem bit barbaric.
If there are no optimization options or compiler switches to minimize memory consumption, is there a method that at least would tell Windows OS to use *page file*, while the program is inactive?
thanks in advance
Mike
|
|
|
|
|
Starting at the end, you don't have to *tell* windows to use the page file, it will do so on it's own; not sure what algorithm it uses to determine what blocks to swap out, but i'm sure as long as your program is sitting quietly, it will Do The Right Thing.
If you want to try using something other than MFC, ATL+WTL sounds like it might be a good choice. Don't use it myself though, so can't say for sure.
Finally, a quick-and-easy way to go would be to compile using MFC as a shared library, and use some of the tips given in these articles:
http://www.codeproject.com/tips/reducesixeexe.asp
http://www.codeproject.com/tips/aggressiveoptimize.asp
And if words were wisdom, I'd be talking even more. The Offspring, I Choose
|
|
|
|
|
1. Can you create syntax hilighting for a new filetype?
2. Can you associate a new file extension with as an existing type? (ie .tmpl as an HTML file)
<rant>
1. Its cool that you can save a keyboard scheme but it sucks that you can't do the same for fonts and colors. You have to export the registry settings.
2. You can't have more than 1 row of window tabs (or can you?). Scrolling gets annoying.
3. It seems really slow when you select a filter in help.
4. The HTML editor adds lots of crap to your code.
Todd Smith
CPUA 0x007 ... shaken not stirred
|
|
|
|
|
I have created an MDI application whose view is derived from CList. I only have one view and one document. I have used the cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
option to disable the default OnFileNew(). Now I have a application that opens with only a menu. How do I now call my List view(default view) from the mainframe menu? I have added a menu Item, attached a handler to it and tried calling OnFileNew from there. But no List view. Sob. I have read a million msdn files, 2 chapters on MDI applications but still no flashes of intelligence. I'm trying to populate my ListView9defaultview) with items by directly accessing its list control through a call to GetListCtrl() in the OnInitialUpdate() function in my view class. If I take the code populating the control out from OnInitial update, I get a white empty file opening, if I leave it in I get a file with exactly the same grey background as my main window. Am I maybe missing the plot completely? I hope I'm making sense, my brain is so fried it took me 20 minutes to find my office key and leave the building. Please help!
Grasp it but you cannot get it!
It's name is memory..
|
|
|
|
|
Had a cup of tea, am felling calmer so here are more details. The view that I'm trying to call is derived from CListview and is a report style List view showing database information in an Access like gridview.
This is the code I'm using to initialise it
DWORD dwExStyle;
CRepPartDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//CActionsApp *pApp = (CActionsApp*)AfxGetApp();
CListCtrl& m_List = GetListCtrl();
dwExStyle = m_List.GetExStyle();
dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES;
m_List.SetExtendedStyle(dwExStyle);
m_List.SetBkColor(RGB(255, 255, 255));
ASSERT(m_List.GetBkColor() == RGB(255, 255, 255));
m_List.InsertColumn(0,_T("Share"),LVCFMT_LEFT,160);
m_List.InsertColumn(1,_T("Status"),LVCFMT_LEFT,90);
m_List.InsertColumn(2,_T("Action Date"),LVCFMT_LEFT,90);
m_List.InsertColumn(3,_T("Book Date"),LVCFMT_LEFT,90);
m_List.InsertColumn(4,_T("Comment"),LVCFMT_LEFT,160);
I have used it before in a SDI application that opened on this view with no problems whatsoever, which leads me to believe there must be a special way of calling the same view from a menu within a MDI application that I'm missing.
This is the only code I have in the menu handler function at the moment
CRepPartApp* pApp = (CRepPartApp*)AfxGetApp();
pApp->m_pDocManager->OnFileNew();
All the example's I can find deals with multiple document and views and switching between them. It is a new job and I'm feeling a bit incompetent so any pointers would be much appreciated
Grasp it but you cannot get it!
It's name is memory..
|
|
|
|
|
I tried a search but didn't find anyone ever asked this question. Is it too simple?
Well, my question is, in my SDI application, on menu item -- action -- I would display a modeless dialog. the code is:
CMyDialog *pdlg;
pdlg = new CMyDialog();
if ( pdlg != NULL )
{
pdlg->Create(IDD_MY_DLG, this);
pdlg->ShowWindow(SW_SHOW);
}
The dialog shows and functions well, but it would be always on the top, even when it lost focus. Is it possible to hide it behind my SDI application when I click on my SDI?
Thank you!
|
|
|
|
|
You may try with changing 2nd parameter in the call to CYourDialog::Create to GetDesktopWindow().
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi Tomasz, your advice works well to hide my modeless dialog. Thank you!
But by passing GetDesktopWindow() instead of "this" as the second parameter, I couldn't get access to my SDI in the dialog using GetParent(). I need to post back some message to my SDI in the dialog when a button is pressed. Any suggestion?
|
|
|
|
|
hmm, maybe I can add a member variable of CMyview to myDialog and initialize it after I create the dialog.
|
|
|
|
|
Does anyone ever developed one ? Where I can find information about this ?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
MDAC SDK should have this info. There's even 'Sample OLEDB Provider' sample, at least in v2.5 which is on my disk.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tks !
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
Till now on, i've always just written programs using C, often MFC along with it. But i just keep calling functions and i know how to use all of that but i dont really understand how they work... i mean, i would like to know:
a) Is it possible to directly access hardware through C (like for example video memory)
b) Where can i get examples/source of this?? (for instance winsock source or some display library or something)
I just mean that i would like to be able to work on a lower level closer to the hardware to manipulate it better, like for example whats the code to draw a black pixel on the screen in pure C? don't you need to access the video card or something? (when not using ready-made api's)
I hope you know what i mean...
Thanks.
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Windows and other OSes generally isolate you from hardware through their abstraction layers. So you can't get the address of video memory and write a byte there. Instead you have to use DirectX, which is a part of OS and provides the programmatic interface for you. The layer between your program and hardware is not very thick in this case.
OTOH, if you want to go hardcore, you'll need to create a device driver. These are the beasts which are allowed to talk to hardware directly.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm trying to flush all system buffers associated with a drive on a Win 2k system. The only way I found is to use an Int 21h function 710Dh from the SDK documentation. Can anyone think of another simple way to do this?
I think this will help me with my testing, but it isn't worth spending a lot of time on.
Brad Manske
|
|
|
|
|
Brad Manske wrote:
The only way I found is to use an Int 21h function 710Dh from the SDK documentation.
Does Int 21h work on W2k?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm guessing that it will not. The page in the SDK is under a heading for 95/98/ME.
Brad Manske
|
|
|
|