|
ActiveX covers a lot of ground. I'll assume you want an activex control.
The easiest way to do this is to create a new project using Visual Studio Appwizard. Select ActiveX Control as the project type.
Once again use the wizard (Classs Viewer) to add the public interface to the control. (What calls the VB program can make to your control.
This results in a skelton of your final control. From here, you just need to move the code from your existing app into the activex control.
|
|
|
|
|
Anyone know how to uninstall deskbands and remove them from the menu in IE?
Somehow while fiddling with the deskband tutorial here on CP I managed to get an empty deskband entry on the deskband menu in IE. I can check and uncheck it and nothing happens (since I used regsvr32 /u to get rid of the dll) but nothing I try makes it drop from the list!
Are these perhaps stored in the registry somewhere? Too bad the menu name is blank or i'd hunt it down!
It seems benign. It just gets on my nerves.
Thanks for any help!
|
|
|
|
|
Hello,
I have 2 questions.. I have researched this for a while and I am very frustrated, so any help will be greatly appreciated. I finally figured out that if your deskband inherits from IPersistStream, explorer won't release the dll when you close the deskband. Why is this??? Second question. Is there a way for a deskband to close itself? In other words, can a deskband tell it's owner that it wants to close?
Thanks
|
|
|
|
|
i have a public DCB variable(DCB m_dcb) in a class called Comm which is in Comm.h file. In Comm.cpp am accessing the m_dcb through a member function. this member function i am calling from the App file. Its compliling & linking. But whrn u go in debug mode or run the appliaction,the member function not able to recognize the DCB variable and throws the error "(MSVCRTD.DLL)0xC0000005:Access violation" at the "FillMemory(&dcb, sizeof(dcb),0);" line.
My code is as follows.
///////////////Comm.h///////////////////////////////////
class Comm
{
private:
BOOL OpenComm(CString strPort);
BOOL SetComTimeOuts();
BOOL SetComState();
public:
Comm(CString port = "COM1");
virtual ~Comm();
BOOL Connect(CString sPort);
BOOL Disconnect();
BOOL ChangeBaudRate(DWORD dwBaudrate);
private:
CString m_strPort;
BYTE* m_pMsgBuf;
public:
static HANDLE m_hComEvent;
static HANDLE m_hCommHandle;
DCB dcb;
OVERLAPPED osReader;
OVERLAPPED osWrite;
BOOL fWaitingOnRead;
BOOL fWaitingOnWrite;
};
//////////////Comm.cpp////////////////////////
#include "stdafx.h"
#include "CEU Simulator.h"
#include "Comm.h"
BOOL Comm::Connect(CString strPort)
{
if(OpenComm(strPort))
if(PurgeComm(m_hCommHandle, PURGE_RXCLEAR | PURGE_TXCLEAR))
return TRUE;
return FALSE;
}
//opencomm
BOOL Comm::OpenComm(CString strPort)
{
m_hCommHandle = ::CreateFile(
strPort,
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
NULL
);
if (m_hCommHandle == INVALID_HANDLE_VALUE)
{
return FALSE;
}
/*if(INVALID_HANDLE_VALUE == m_Handle && ERROR_ALREADY_EXISTS != GetLastError())
return FALSE;*/
if( !SetComTimeOuts() )
{
CloseHandle(m_hCommHandle);
m_hCommHandle = INVALID_HANDLE_VALUE;
return FALSE;
}
if( !SetComState() )
{
CloseHandle(m_hCommHandle);
m_hCommHandle = INVALID_HANDLE_VALUE;
return FALSE;
}
return TRUE;
}
// setcommtimeouts
BOOL Comm::SetComTimeOuts()
{
COMMTIMEOUTS commTimeOut;
commTimeOut.ReadIntervalTimeout = MAXDWORD; // | Read operation should return immediately
commTimeOut.ReadTotalTimeoutMultiplier = 0; // |=> with chars that have been revceived, even
commTimeOut.ReadTotalTimeoutConstant = 0; // | even no chars have been received
commTimeOut.WriteTotalTimeoutMultiplier = 2;
commTimeOut.WriteTotalTimeoutConstant = 0;
if( !SetCommTimeouts(m_hCommHandle,&commTimeOut) )
return FALSE; //"error in Commtimeouts"
return TRUE;
}
// setcommstate
BOOL Comm::SetComState()
{
char buf[60];//={'\0'};
// DCB dcb;
FillMemory(&dcb, sizeof(dcb),0);
dcb.DCBlength = sizeof(dcb);
sprintf(buf,"%s:%d,%c,%d,%d","COM1",BAUDRATE,'N',8,1);
if( !BuildCommDCB(buf,&dcb) )
return FALSE; //error in building comm
dcb.BaudRate = BAUDRATE;
dcb.ByteSize = BYTESIZE;
dcb.Parity = FALSE;
dcb.StopBits = FALSE;
dcb.EvtChar = EVTCHAR;
dcb.fDtrControl = TRUE;
dcb.fRtsControl = TRUE;
dcb.fOutxCtsFlow = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fDsrSensitivity = FALSE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
dcb.fTXContinueOnXoff =FALSE;
dcb.XonChar = XONCHAR;
dcb.XoffChar = XOFFCHAR;
dcb.XonLim = FALSE;
dcb.XoffLim = FALSE;
dcb.fBinary = TRUE;
dcb.fErrorChar = FALSE;
dcb.fNull = FALSE;
dcb.fAbortOnError = FALSE;
dcb.fDummy2 = FALSE;
dcb.fParity = TRUE;
dcb.ErrorChar = FALSE ;
dcb.EofChar = FALSE;
dcb.EvtChar = FALSE;
if( !SetCommState(m_hCommHandle,&dcb) )
return FALSE; //error in CommState
return TRUE;
}
//////////////////CEU Simulator.cpp (App file)////////////////////////////////
#include "stdafx.h"
#include "CEU Simulator.h"
#include "MainFrm.h"
#include "CEU SimulatorDoc.h"
#include "CEU SimulatorView.h"
void CCEUSimulatorApp::ConnectToPort(CString strPort)
{
m_comPort.Connect(strPort);
}
//////////////CEU Simulator.h//////////////////////////////////////////////
#include "resource.h" // main symbols
#include "CEU SimulatorDoc.h"
#include "CEU SimulatorView.h"
#include "Comm.h"
class CCEUSimulatorApp : public CWinApp
{
public:
CCEUSimulatorApp();
public:
Comm m_comPort;
void ConnectToPort(CString strPort);
void DisconnectPort();
void SetBaudRate(DWORD dwBaudRate);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCEUSimulatorApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CCEUSimulatorApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
Pls. help
Rsh
|
|
|
|
|
|
You need to define a variable in the first dialig that will hold the value that you want to pass to the second dialog. In the second dialog, define a variable that will receive the value from the first. For example:
class CMyDlg1
{
public:
int m_x; // this is going to be passed to other dialogs
};
class CMyDlg2
{
public:
int m_x; // this is going to be received from CMyDlg1
}
Somewhere in CMyDlg1, you have a button or menu item that when pressed CMyDlg2 is displayed:
CMyDlg1::OnButton1()
{
CMyDlg2 dlg;
dlg.m_x = m_x; // passing a value from CMyDlg1 to CMyDlg2
dlg.DoModal();
}
|
|
|
|
|
Mel:
Thank you very much,Your help is very valuble for me,Ilike to program in VC at my amature time,I like to do something I interesting.
thanks.
|
|
|
|
|
How about doing it the other way around? Ex. using a settings dialog that will change a variable in the main window?
|
|
|
|
|
I'm analyzing the possibility of using RegisterWindowMessage in order to establish communication between two applications.
Is this the best way to accomplish such task? It looks like the easiest one.
rechi
|
|
|
|
|
Registered message or PostMessage(HWND_BROADCAST, ...) are the most simple ways to communicate between GUI applications, if information you need to send can be placed to wParam, lParam.
|
|
|
|
|
I have just created a DLL that has a CreateDisplay funtion that I wanted to be able to pass a time-out value to. When the CreateDisplay function is called, everything is ok BUT the timer functionality. The CreateDisplay function calls a modal dialog that contains 2 text fileds and a hidden button. The dialog created in an MFC App with the same code works fine. (meaning, I know that the settimer and ontimer code is ok). I have thrown in MsgBoxes during the dll's settimer and ontimer code. If the timer message is thrown BEFORE the dialog is drawn, then I get OnTimer hits, however, once it is displayed, I get nothing (spy++ shows nothing as well). And, from the message trick, I know the settime is getting set when I want it to.
So what is my problem???
If it is a message pump thing due to the dll, can someone point me as to what I need to do. (relizing I have never done it)
Thanks.
|
|
|
|
|
After adding the application library to the same folder under which the application itself is located, from Project->Settings->Link under 'Object/library modules', I entered the directory and subdirectory path information. However, when I tried building the program, it produced an error stating it couldn't open one of the files.
The file to which the error is referring, is right there in the library, and is under the same directory as the program itself.
Because this is a local library used only for this application (and one other), I don't want to use Tools->Options->Directories to enter path information for an application I won't be using too often.
Might someone know why the program isn't seeing the file? (No ".dll's" are involved here.)
Running VC++ 6.0
Thanks.
William
|
|
|
|
|
We have all probably had that identical problem. It usually caused either mispelling the name of the *.lib or entering the wrong path to it.
1. If the *.lib is located in the project's root directory you do not need to provide the path.
2. Make sure you spelled it correctly.
3. If you want to include the path, make sure the path is correct.
|
|
|
|
|
Your reply reflects the experience of someone who has walked that path before. However, take my word for it, they are not applicable in this case since they were the very first set of things I checked.
The file the application says it cannot open, is actually in the 'Include' folder which is a subdirectory of the same directory under which the application subdirectory is located. IOW, library folder, 'Include' folder, and application folder, are all subdirectories of the same directory (which is a subdirectory of the root directory).
I even did a Build->Clean to ensure no leftover baggage is what might be responsible for what's happening. It didn't solve the problem.
Something else I noticed. No matter how many times I changed Project->Settings under "Settings For:" from Win32 Release to Win32 Debug (and press OK), after I run the application, Win32 Debug gets changed right back to Win32 Release.
Because I didn't write all of the code, I'm wondering whether in some obscure place, somebody left something in it that's causing this.
I sometimes use terminology which I do purely for the convenience of communication. For example, I named the folder "DaoLib" where I have the 'Include' folder defined under, then another folder (likewise defined under) containing the "*.lib" file, and thirdly, the application folder (likewise defined under) that contains the dozen or so '.h' files, '.cpp' files, and resource files (etc.). My use of the word "library" was meant to indicate the "DaoLib" folder.
Thanks.
William
|
|
|
|
|
Since I don't know your directory structure, lets assume it is like this:
c:\DaoLib
c:\DaoLib\include
c:\DaoLib\lib
c:\DaoLib\ProjectFiles (*.cpp, *.h *.rec, *.dsw, etc)
When you compile, the current directory is actually c:\DaoLib\ProjectFiles, So in Project | Settings | C++ Tab | Cateroy "Preprocessor", "Additional Include Directories" you should have "..\include". And in Project | Settings | Link Tab, Category "Input", "Additional Library Path", you shoud have "..\lib"
Whenever you open Project | Settings, the dropdown for Settings For always reflects the Current Active Configuration, either Release or Debug (or some other configuration you may have added to the project).
|
|
|
|
|
Thanks Mel, I've gotten passed all that already. I had to do the physical hardcoding of the path (e.g. "..\DaoLib\Include" etc.) for each of the '#include' statements the compiler was saying it couldn't find the file.
I've done all that already, and it works. (To be honest, I'm not a big fan of hardcoding directory information in the '#include' statements, and was looking for a simpler way through using Project->Settings->etc.) But those problems are now history.
The one that's happening now is coming from the linker which says it cannot find the *.obj file.
Thanks for any help.
William
|
|
|
|
|
I gave up in the end and hard-coded the shortened form of the directories in each "#include" statement for which the compiler was saying it couldn't find the '.h' files. This got me through the compile part of the build, but now I have a new error which says the linker cannot find the *.obj file.
William
|
|
|
|
|
I've set the Active Configuration to Win32 Debug, but still have the linkage problem.
William
|
|
|
|
|
Does anyone know the maximum possible size of a std::string ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Theoretically at least, std::string::max_size() is such value.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
You can call max_size function to check this. On my computer this function returns maximum value for UINT type.
|
|
|
|
|
What's a good book for building multithreaded applications in windows specifically and C++ generally?
i came across this book "Object-Oriented Multithreading Using C++
Author: Cameron Hughes, Tracey Hughes "..is this worth it? or is there any other ones out there that could be better?
thanks
|
|
|
|
|
Check out www.amazon.com. They usually have book review by its readers and have references to other similar books.
|
|
|
|
|
Does anybody know how to navigate the controls which over a TabControl by TAB key? I can tab on tab header most but never tabbing through the controls over it. I created main dialog, tab pages dialogs and main dialog with a resource editor. Looking well and can successfully change pages, nice working but... What is the magic codes for solution? (if possible with only api codes. But suppose,if possible, not much diferent)
Note: all controls and SysTabControl32 also has WS_TABSTOP style. But in fact I didnn't saw any example that can do this(CodeGuru, CodeProject) except one but that was a PropertySheet inherited ownerdrawn tab cotrol, this means any but why?
|
|
|
|
|