|
|
in my regular MFC dll project, i create a dialog resource assoicated with a class CTestDlg, and it can normally show in my client application which uses the dll.
But after i added a ActiveX control(IE Control, for example), the dialog can't be displayed and if i call a method of the ActiveX control, the debug assert failed dialog will appear: ASSERT(m_pCtrlSite!=NULL) fails.
so how can i use ActiveX control correctly in DLL?
thanks.
|
|
|
|
|
Make sure you call AfxEnableControlContainer() before using any ActiveX control.
|
|
|
|
|
Thanks
i have already called AfxEnableControlContainer() in the InitIntstance in the dll project, but still get the same problem...
|
|
|
|
|
Make sure also your activeX control is registered (I know this sounds like a stupid suggestion but you will have these kind of results if your ActiveX is not registered).
|
|
|
|
|
Thanks, but i use the IE control and i think it must be registered,
i have got the solution from a forum:
HRESULT hr = OleInitialize(NULL);
if (hr == S_FALSE)
{
OleUninitialize();
}
// Call if using OLE Controls
AfxEnableControlContainer();
// Register all OLE server (factories) as running. This enables the
// OLE libraries to create objects from other applications.
COleObjectFactory::RegisterAll();
Thanks anyway~
|
|
|
|
|
Hi !!
I'm developing an app for a computer store. It can draw some barcodes (thanks to the manual on this site) and now what I want is to know how to send to the display that shows the article and price when the barcode reader reads article's barcode.
Display must be at COM1.
Thanks !!
|
|
|
|
|
Hello,
I was hoping someone could point me in the right direction with my problem. I have been developing in Access for quite some time now and I am increasingly finding the limitations on form design frustrating, so I have decided to go with good old C++ programming. However I have no desire to create a DB engine when MS Access does such a nice job. I was wondering if someone could provide suggestions on references I could obtain to allow me to develop my interface and logic in C yet still use Access/SQL server as the backend database? Any help will be greatly appreciated.
|
|
|
|
|
Yup. You can use a variety of APIs to do this; ODBC, DAO, ADO or OLE DB, for example.
For Access only, DAO used to be the choice. However, my personal favourite is OLE DB. This (like ODBC and ADO) is driver or provider based, and allows you to write code that works against any database. That's the theory, but not always the practice, since there are driver/provider specific bits that make it more difficult.
I use the ATLDBCLI.H header (supplied with VC6 and later) which allows you to manipulate recordsets based on pre-defined SQL and known columns, as well as on dynamic (user-defined) data. To make the most of this, you should start with something like the SAMS "Database Programming with Visual C++ 6 in 21 days" book, but don't expect it to take only 21 days!
What you will miss in straight C++ is data-aware controls, and the reporting, unless you use something like Crystal Reports. I keep meaning to write a CP article on C++ report generation, but never seem to have the time For grid stuff you can use the excellent Grid control from Chris right here on CP.
Steve S
Developer for hire
|
|
|
|
|
Thankyou for the advice. Is there other references that you know of besides the SAMS 21 Day book? I am usually not a big fan of those books; I usually find them lacking with respect to in depth coverage of the subject. I will look into the book though, just wondering if you knew of any others.
|
|
|
|
|
I created a MDI with Visual C++ .NET. When I execute my program it shows a default client window. I want to get rid of that window but I cannot find how to disable it. Does anybody know?
Willem
|
|
|
|
|
From the CCommandLineInfo::m_nShellCommand docs:
BOOL CMyWinApp::InitInstance()
{
...
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
if (!ProcessShellCommand(cmdInfo))
return FALSE;
...
};
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
|
|
|
|
|
|
Ive written a small program with two dialogs using ADO datacontrols and Microsoft datagrid the program works.
What I want to is chnage the connect string as the second dialog is opened so that I can make my app portable when I try to do this I get assertion error if place the code in button on the dialog it works. Any suggestions
Donald
|
|
|
|
|
Hi
How do I remove that border that surrounds the window when you create it with Win32?
|
|
|
|
|
Create it with just the WS_POPUP and WS_VISIBLE styles.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I need to develop a program for printing deocuments. when I will setup this program in a machine, the setup will automatically create a icon (not shorcut) in desktop. when user will right click on this icon the menu will be customized, when user click on properties, the program will bring its own property window. like "MyComputer", Recycle Bin", "Outlook".
is it possible? can you guide me how I can implement it, Please.
Saifur Rahman
|
|
|
|
|
Saifur Rahman wrote:
is it possible
Yes
Saifur Rahman wrote:
can you guide me how I can implement it,
Read the articles in the shell programming section. Mike Dunn has written a series of articles which if you follow sequentially...you should be able to do what you wish.
Probably of most interest to you[^]
Cheers
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
I got the program that when its ran it will display 10 lotto numbers. However i raninto a problem, everytime i run it i get numbers that are the same in the draw. Can anyone give me some advice or help on how i can prevent that from happening. Can i do FOR statement to reset all to 0 or set array to 0? how would i go doing that? I included the program below.
//sp
//11/30/04
#include <iostream>
using namespace std;
#include <iomanip>
using std::setw;
#include <cstdlib>
#include <ctime>
int main()
{
const int size = 6;
int a[size] = {0,0,0,0,0,0};
srand(time(0));
for(int w=1; w<11;w++){
cout <<"For game #"<< setw(3) << w << "=";
for(int i=0;i<size;i++){
a[i] = rand()%59 + 1;
cout << setw(5) << a[i] <<" ";
}
cout <<endl;
}
cout <<endl;
return 0;
}
|
|
|
|
|
The problem is probably coming from the way you're handling the return value from the rand() function, which returns a value in the range 0 to RAND_MAX . Try using the following:
a[i] = (rand() * 59) / RAND_MAX;
Software Zen: delete this;
|
|
|
|
|
hi, thanks for the reply.
i try the method of yours and it still output same numbers in draw.
|
|
|
|
|
|
aaaah.....that happenz coz the random function that uses this.....is not a good function to be used.....
try something like using the system time and date and feeding it to a ur own random number generator based on this.....
that ought to help.....
happy programmin.....
cheerz.....
|
|
|
|
|
What you have appears to be fine. srand() is called correctly, which is what most folks fail to do when seeing the same numbers over and over. You should be getting six pseudo-random numbers in the 1-59 range.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I want to make a server client program that administers all computers in a network. The problem is that I don't know how to get all the computers on a network. Can someone tell me if are there any projects here that might help ?
Thanks.
gabby
|
|
|
|