|
I don't understand... I have used for a long the property sheet and each page has its OnInitDialog function (If I have needed it, of course...).
The only problem is that property pages are not created until they have been focused unless you set this flag in their creations: PSP_PREMATURE
from MSDN:
PSP_PREMATURE Causes the page to be created when the property sheet is created. If this flag is not specified, the page will not be created until it is selected the first time.
Hope this helps...
|
|
|
|
|
I am writing a program which runs just fine in the computer where I am developing it. The OS is Windows XP. Since I wanted someone else to see my program I tried to run it on an old laptop that I have which runs on Windows 95. Unfortunately I got an error generated with _com_error which says:
Error Number: 0x80040154
Error Message: Class not registered.
I fixed this error by installing DCom95 and MDAC 2.5 Service pack 3 because they were required for windows 95.
However I get another error which says:
Error Number: 0x80004002
Error Message: No such interface supported.
This is part of the code
// Initialize the COM environment
if( FAILED( hr = ::CoInitialize( NULL ) ) )
{
_com_issue_error( hr );
}
// Create a connection with the database
// THE FIRST TIME THE PROGRAM WOULD FAIL RIGHT HERE
if( FAILED( hr = m_pConn.CreateInstance( __uuidof( Connection ) ) ) )
{
_com_issue_error( hr );
} // end if
m_pConn->Open(L"Provider=Microsoft.Jet.OLEDB.3.0;\
Data Source=SomeDbFile.mdb;",
L"", L"", adOpenUnspecified );
// NOW IT FAILS RIGHT HERE
// Create an instance of Command
if( FAILED( hr = m_pCmd.CreateInstance( __uuidof( Command ) ) ) )
{
_com_issue_error( hr );
} // end if
Besides installing DCOM95 and MDAC Is there anything that I can do to to make the program run in Windows 95?
none
|
|
|
|
|
hey i have the following code in C using the win32 api (not MFC)
<br />
HWND CreateMYToolbar(HWND hWnd,HINSTANCE hInst){<br />
HWND hToolbar;<br />
TBADDBITMAP tbab;<br />
TBBUTTON tbb[3];<br />
DWORD dwToolbarStyle = WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS;<br />
<br />
hToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, dwToolbarStyle, 0, 0, 0, 0, hWnd, NULL, hInst, NULL);<br />
<br />
SendMessage(hToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);<br />
<br />
tbab.hInst = hInst;<br />
tbab.nID = idToolbar;<br />
SendMessage(hToolbar, TB_ADDBITMAP, 1, (LPARAM)&tbab);<br />
<br />
ZeroMemory(tbb, sizeof(tbb));<br />
<br />
tbb[0].iBitmap = 1;<br />
tbb[0].fsState = TBSTATE_ENABLED;<br />
tbb[0].fsStyle = TBSTYLE_BUTTON;<br />
tbb[0].idCommand = FIRST_COMMAND;<br />
<br />
tbb[1].iBitmap = 2;<br />
tbb[1].fsState = TBSTATE_ENABLED;<br />
tbb[1].fsStyle = TBSTYLE_BUTTON;<br />
tbb[1].idCommand = SECOND_COMMAND;<br />
<br />
tbb[2].iBitmap = 3;<br />
tbb[2].fsState = TBSTATE_ENABLED;<br />
tbb[2].fsStyle = TBSTYLE_BUTTON;<br />
tbb[2].idCommand = THIRD_COMMAND;<br />
<br />
SendMessage(hToolbar, TB_ADDBUTTONS, 3, (LPARAM)&tbb);<br />
<br />
return hToolbar;<br />
}<br />
ibitmap is a bitmap image in the resource file.
the code compiles but the application crashes when it is started. the other problem is when i did actually have this code working the bitmap didnt show up on the buttons..can anyone show me an example of using the win32 api and common controls to create a toolbar and use bitmap images from resource, or fix the code above so it works
thanks in advance. go easy on a beginner
julan
|
|
|
|
|
I need to map the Right Mouse Button Click
on a control being part of a CFormView.
OnRButtonDown function maps mouse click
only in the CFormView and not in its clients
controls.
WM_MOUSEACTIVATE message works even for
my window even for its client controls but
maps all mouse buttons.
What can I do ??
How can I check mouse buttons status when
WM_MOUSEACTIVATE button is received ??
It there another solution ??
Thanks a lot !!!
|
|
|
|
|
Hi all,
I have a console c++ application, and I would like to know what I need to do to add the MFC GUI interface to my consol application (legacy classes changes? calling conversion?).
10X.
|
|
|
|
|
O.K friend You can do that.
To do that in simpler way,
->start a new project.
->Win32 Console aplication.
->click next
->select "An Application that supports MFC"
or see the code generated in this method and copy the MFC initialization code and then use that in your console application.
Do remember you need to initialize MFC then only you can use it.
now you are o.k. you can use the MFC functionality without any problem.
if you need any help that i can do feel free to contact me at
harinath@vandemataram.com
Harinath Reddy
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
harinath@vandemataram.com
|
|
|
|
|
I have created a thread with "MyFunc" function (see below). "MyFunc" call dialog, which release semaphore. And after I have called "WaitForSingleObject" - the app hanged.
Please help me to solved this problem
typedef struct _THREAD_PARAM
{
HANDLE m_hSemaphor;
} THREAD_PARAM;
CMyDlg::CMyDlg(HWND *phWnd, void *pData, CWnd* pParent /*=NULL*/)
: CDialog(CReadSmblDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CReadSmblDlg)
m_sEdit = _T("");
//}}AFX_DATA_INIT
m_phWnd = phWnd;
m_hSemaphor = NULL;
m_pData = (THREAD_PARAM*)pData;
}
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
this->GetDlgItem ( IDC_EDIT )->SetFocus ();
m_sEdit = "";
UpdateData ( FALSE );
*m_phWnd = this->m_hWnd;
if ( m_pData->m_hSemaphor )
ReleaseSemaphore ( m_pData->m_hSemaphor, 1, NULL );
return TRUE;
}
UINT MyFunc(LPVOID p)
{
CMyDlg dlg ( &g_hWnd, (THREAD_PARAM*)p, AfxGetMainWnd() );
if ( dlg.DoModal() == IDCANCEL )
g_hWnd = NULL;
return 0;
}
{
....
g_hWnd = NULL;
THREAD_PARAM *pData = new THREAD_PARAM;
if ( !pData )
return;
pData->m_hSemaphor = CreateSemaphore ( NULL, 0, 0x7FFFFFFF, NULL );
if( !pData->m_hSemaphor )
return;
AfxBeginThread ( MyFunc, pData );
WaitForSingleObject ( pData->m_hSemaphor, INFINITE );
...
}
|
|
|
|
|
I need just to have an ie control window in my dialogbox.... something like the popup who appear when you login into messenger chat....
I have a simplest win32 console application, without MFC.
I maked CreateDialog, to open a dialog box window, from a dialog resource.
In that dialog i put an dll control of Microsoft Web Browser Object, from controls.
How to connect to that object and tell him Navigate2 ?
(with mfc is very simple is automatticaly link a m_spBrowser variable....)
Adrian Bacaianu
|
|
|
|
|
Problem in changing the progress abr color
I want to incrementing in a progress bar in loop
for(int i = 0; i < 3800; i++){
m_pb1.SetPos(i);
}
I just want to change the color of progress bar(i.e from blue to something else) and want to show the percentage of progress inside the progress bar. (i.e if 80% of the bar is colored then "Usage = 80%" should appear inside the progress bar).
The following code is taken from a working project but it is not working in my program.
m_pb1.SetTextFormat("Usage : %d%%", PBS_SHOW_PERCENT);
m_pb1.SetGradientColors(RGB(206,255,157),RGB(0,130,0));
m_pb1.Invalidate();
Plz suggest me the way of doing so.
Reply me soon
|
|
|
|
|
Hello all,
In MFC programming, I get the following data strucutre, and I find the CList seems not working as I want.
The data structure looks like:
//(in the .h file)
typedef CList<cstring,cstring> obj_map_list_type;
CMapStringToOb obj_map;
where each element in the obj_map is a clist type as obj_map_list_type.
I use the obj_map like:
//(in my .cpp file)
obj_map_list_type * obj_map_list;
obj_map_list = new obj_map_list_type;
obj_map_list->AddTail("AAAAAAA");
obj_map_list->AddTail("BBBBbB");
obj_map.SetAt("ABC", obj_map_list);
......
Surely, it is clear that my goal is to construct a CMapStringToOb map, in which each element is a CList containing a list of string.
However, when I try to retrieve the saved data, it is not working. The following code follows the previous code:
//(in my .cpp file)
POSITION pos, kk2;
obj_map_list_type obj;
CString key;
int int_jj;
pos=obj_map.GetStartPosition();
while (pos!=NULL)
{
obj_map.GetNextAssoc(pos, key, (CObject*&) obj);
kk2=obj.GetHeadPosition();
// from debug, I see the kk2 returned is NULL !! strange?
int_jj=obj.GetCount();
// it is strange that int_jj's value is zero!
while (kk2!=NULL) // so this while is never executed.
{
key=obj.GetNext(kk2);
};
};
About the data type convertation in the GetNextAssoc, if I write it like:
obj_map.GetNextAssoc(pos, key, obj);
The compiler will say:
GetNextAssoc' : cannot convert parameter 3 from 'class CList<class cstring,class="" cstring="">' to 'class CObject *&
Anyone has any idea why my CList data can not be retrieved?
Thanks a lot and have a nice day.
|
|
|
|
|
You are storing pointers to your list inside the map, but are trying to retrieve it as an object.
Kevein wrote:
obj_map.GetNextAssoc(pos, key, (CObject*&) obj);
obj is declared as obj_map_list_type rather than as a obj_map_list_type pointer.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thanks. I agree.
But how to change it?
I first new a obj_map_list_type type CList pointer,
give its values,
but how to save this pointer's pointed content to the map?
The map's SetAt function really not smart. :-p
Thanks again.
obj_map_list = new obj_map_list_type;
obj_map_list->AddTail("AAAAAAA");
obj_map_list->AddTail("BBBBBB");
obj_map.SetAt("ABC", obj_map_list);
|
|
|
|
|
Since you are using CStringToObMap, you store pointers in the map, not the objects themselves. To retrieve it again, you need to retrieve the pointer:
CStringList* pList = new CStringList();
// Add stuff to pList...
mapMyMap.SetAt( "Blah", pList );
// Retrieve it
CStringList* pList;
CString sKey;
for ( POSITION pos = mapMyMap.GetStartPosition() ; pos != NULL ; )
{
mapMyMap.GetNextAssoc( pos, sKey, (CObject*&)pList );
// Now access the list through pList
}
The difference here is that we are casting a pointer to the string list to a pointer to a CObject pointer (which is legal since CStringList is derived from CObject), rather than a CStringList object to a CObject pointer, which is never legal.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Many thanks for nice explanation.
It works.
Have a nice day!~
|
|
|
|
|
As Dave said, you need to remember what's a pointer. Change this:
POSITION pos, kk2;
obj_map_list_type obj;
CString key;
to this:
POSITION pos, kk2;
obj_map_list_type* obj;
CString key;
and this:
kk2=obj.GetHeadPosition();
int_jj=obj.GetCount();
while (kk2!=NULL)
{
key=obj.GetNext(kk2);
}
to this:
kk2=obj->GetHeadPosition();
int_jj=obj->GetCount();
while (kk2!=NULL)
{
key=obj->GetNext(kk2);
}
You should also check out std::list<> and std::map<> , which allow type checking and are a whole lot less messy than the archaic CMap and CList .
---
Not one of them, IMO, should be called beer. Maybe malt flavored mineral water.
- Jörgen Sigvardsson on Bud, Coors and Miller
|
|
|
|
|
Thanks a lot for your demo code.
Have a nice day!~
|
|
|
|
|
Please can any one help, how to add closed caption text to Video using Overlay Mixer. In Win XP we can do it using VMR interface. but i want it in 2000. can any one help.
Thank You
Prudhvi
|
|
|
|
|
Hi everyone.
I've read a lot of articles on this Page an I suppose this is the best C++ site on the NET. Thanx for this nice community. Nevertheless I am new in this Messageboard, so greetings to everyone and I hope that this conversation will be as nice as all other stuff on this page.
Now my Question!
My current project follows my idea to encode a nice platformindependent (Windows and Unix) "Reverb-Engine". I know, there is a lot of finished reverb-code on the net, but I try to make my own for practice.
I tried the winmm.lib to make my Waveoutput play. It works poperly and Big thanks to Pierre Canthelou for his clean Engine. Your concept of "three-bufferning" was a big deal. I spent a lot of time to make it work with double buffering, but those clicks made me dizzy. Thanks a lot. Three buffers. Just one index away from my goal.
But now about my question; Pierre Canthelou and me use the delivered winmm.lib to make the Wave-output work. I am coding since win98 and this lib is working without problems except this one: I am able to select a wave-device and the sound is always playing, but if I select my second soundcard the sound comes from my first device. After a long time of debuging I discovered, that my sounddevice is always my primary soundcard that is selected within the "sound-tool" placed in the control-panel of Windows. That means: Only my WAVEMAPPER-Soundcard plays my sound. With this problem in head I was searching for a while on the net about whats going on (I use Win XP at this time) and discovered this:
winmm is slow (I never made the benchmark by myself!). There are more powerful engines (for example direct sound from Microsofts DirectX)
I try to develop platform independent software (for practice at all) and I would like to connect to the sound driver directly. Is there any page or information on the net that delivers information about connecting (low level) to windows-drivers.
I know it is not neccesary, but I am freak about trying everything out.
If you can help me I would be happy about your answer.
Greetings
Jacek Wisniowski
|
|
|
|
|
Hey,
I'm trying to close Kazaa using an IE toolbar. Kazaa has a system tray icon so it cannot be shut down using WM_CLOSE, it just minimizes to the tray. Someone suggested that I use TerminateProcess but I am having trouble.
To terminate the process you have to find the ExitCode, this is the code to find the ExitCode:
<br />
BOOL GetExitCodeProcess( <br />
HANDLE hProcess, <br />
LPDWORD lpExitCode<br />
);<br />
but to actually terminate the process the code is:
<br />
BOOL TerminateProcess(<br />
HANDLE hProcess, <br />
DWORD uExitCode<br />
);
When I try to execute the program I get the error:
cannot convert from 'unsigned long *' to 'int'
I am not sure how to convert the pointer to an int, can anyone help me?? Thanks.
|
|
|
|
|
You only need to call TerminateProcess() to kill a process. GetExitCodeProcess() is used if you want to find out a process's exit code *after* it has finished.
But to answer your original question, you are probably doing this:
DWORD exitCode ;
BOOL rc = GetExitCodeProcess( hProcess , exitCode ) ;
when you need to do this:
DWORD exitCode ;
BOOL rc = GetExitCodeProcess( hProcess , &exitCode ) ;
If GetExitCodeProcess() succeeds, it will have placed the appropriate value in 'exitCode' for you.
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.2 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I tried this:
DWORD exitCode;<br />
BOOL getcode = GetExitCodeProcess(winKazaa, &exitCode);<br />
BOOL terminate = TerminateProcess(winKazaa, exitCode);
but it didn't work. Is there something I'm still doing wrong?
|
|
|
|
|
Sigh...
Ignore my previous post. I should really read the question properly before answering these things
I just tried compiling your sample and it worked fine!
The compiler error suggests that the problem is with winKazaa, not exitCode (assuming it is a HANDLE). You may be pulling in a header file that defines one of the functions you're calling with a different parameter list (!)
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.2 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hi there. Is there a quick answer to this following question:
What's the difference between automation compliant COM and ActiveX component.
Thanks
norm
|
|
|
|
|
Nothing!
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
"Nothing" as in "No difference"?
I just want to reconfirm this. Thanks
|
|
|
|
|