|
i derived propertysheet in that i want to hide some buttons
my code is like this
CButton* m_ApplyButton;
CNSPropertySheet* pSheet = dynamic_cast < CNSPropertySheet*>(GetParent());
ASSERT(pSheet);
m_ApplyButton = reinterpret_cast<CButton *>(GetDlgItem(IDC_FORM_APPLY));
pSheet->GetDlgItem(IDC_FORM_APPLY)->ShowWindow(FALSE);
but i am not getting handler in m_ApplyButton
how to get that handler
|
|
|
|
|
It's been a while for me messing around with property sheets, but the easiest way to hide the apply button would be applying the "PSH_NOAPPLYNOW" attribute.
Anyway I think you are using the wrong Control ID. I think it should be IDAPPLY or something like IDC_APPLY.
see http://msdn.microsoft.com/en-us/library/bb774538(VS.85).aspx?info=EXLINK[^]
some code from one of my ctor's for PSH_NOAPPLYNOW
<br />
m_psh.dwFlags |= PSH_NOAPPLYNOW; <br />
m_psh.dwFlags &= ~PSH_HASHELP; <br />
m_dlgOptionsUsers.m_psp.dwFlags &= ~PSH_WIZARD;<br />
m_dlgOptionsSMB.m_psp.dwFlags &= ~PSH_WIZARD;<br />
So long,
Stefan
|
|
|
|
|
HI All,
Im new to MFC. I need to use Mschart in VC++.I dont konw how to use in my project.Plz help me.
Thanks & Regards
Anitha
|
|
|
|
|
|
Im using Microsoft Visual Studio 2005. yes, I tried that model. But it showing the error msg "error C2039: 'SetChartData' : is not a member of 'CChart1'". I used the ActiveX control.
Regards,
Anitha
|
|
|
|
|
How to get object or handle of control in its event handler function without using its ID ?
I have created a button "OK" and its handler onOK(), I want to know how i wll get its handle or object inside onOK() function. I dont want to use its ID like getdlgItem(ID_OK)..
onOK()
{
CButton *obj = ? ;
}
If any body have solution please reply
Chetan m.p.
chetan.official@gmail.com
|
|
|
|
|
Create a CButton control variable in the class.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
thank u
my project having 6 forms with 30 edit box on each,i dont want to make memeber variables for each forms.
I made one class inherited in all forms ,and having one function fnOnchange() & i wana to call these generalise function call on each onchange of buttons
CGeneralize
{
public:
fnonchange()
{
// get handle of cntrl
....
cntrl->getWindowtext(str);
.....
}
}
CForm1:public CGeneralize
{
onOK()
{
fnonchange();
}
.
.
//similarly for all 30 buttons .
.
.
}
.
.
.
//similarly for all 6 forms
Suggest me another solution
Chetan m.p.
Soft.Engg.
|
|
|
|
|
See if I got this right:
1. You don't want to create member variables
2. You don't want to use GetDlgItem
3. You want to get a CWnd pointer, or handle, to the control in your message handler
4. You are using MFC
There's no solution that satisfies those requirements.
Find something else to do.
...and you actually have 6 forms with 30(!) edit boxes....
For what it's worth...
if I ever had to do such a monster I would create a container that would hold all those control variables, e.g. a map that maps the ID of the control to the CEdit instance. I would also use ON_CONTROL_RANGE so I wouldn't have to write a message handler for each control.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
|
I am using two third party com dll . I am facing the problem that their clsids are same ,so i can
use only one dll. but my project requirement is to use both the dll . Is their any way to
change the clsid of the com dll . any binay tool etc. any another trick.
Rajesh
|
|
|
|
|
rajeshgupta1253 wrote: clsids are same
Is it the name that's the same or the GUIDs(it can't be)?
ATL COM DLLs come with namespaces if you have the tlb file associated with them, namespaces does help avoid such cases.
Then there is a rename attribute that can be used with a tlb file while using #import .
From MSDN:
The rename attribute is used to work around name collision problems. If this attribute is specified, the compiler replaces all occurrences of OldName in a type library with the user-supplied NewName in the resulting header files.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
|
This is supposed to be a no-no....
If the two servers have the same class id, then it is the same server, by definition and by COM spec. It may be that the later server is an updated version, but it is still the same server.
If the supplier of the two servers claims that those are two different servers, they have broken some of the fundamental rules of COM and there are no guarantees for this to work when distributed even if you might get it to work on your machine.
The human readable ProgID may be updated with a new version from e.g. <Company>.<Server>.1 to <Company>.<Server>.2, then they also have to give the server a new class id.
If the supplier of the two servers confirms that this is the same server, then your project requirements are wrong or misinterpreted since this is not how the COM architecture works.
It may give a hint if you compare the ProgIDs.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I guess the coders had a sample project and had written some code but not changed the CLSIDs.
Greetings from Germany
|
|
|
|
|
Different CLSID for different modules is a primary role for COM. The CLSID should be changed if there is no compatibility in the interface!!!!
You better explain the creators of the dlls that the same CLSID are crappy.
I bet that they came from the same person who hasnt enough experience to deal with COM.
Greetings from Germany
|
|
|
|
|
Hi What is the correct way to avoid globals in accessing callbacks.
E.g.
A signal handler for ctrl-C or similar.
I have seen the boost:function and boost::bind used for user defined callbacks but I am yet it to see this being used for a standard C system library with callback.
E.g.
void sig(){};
int main()
{
signal(SIGINT,sig);
}
If sig was a member of a class is it possible to use boost::bind or otherwise so that when a signal interrupt is generated it is possible
to access the members of the class without the use of globals?
Regards,
flip
|
|
|
|
|
Hello Friends,
I have an <b>ATL project in Visual Studio 2005, but now I want it in Visual C++6.0.</b>
I have used one utility available on Code Project only i.e.
<b>prjconverter.exe</b>
it converted .sln to .dsw BUT on building the project,
I am having many error, mainly
<b>"C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(2945) : error C2065: '_Module' : undeclared identifier"</b>
Because even in converted project,
class Coeapi_sampleModule : public <b>CAtlDllModuleT</b>< Coeapi_sampleModule >
{
public :
DECLARE_LIBID(LIBID_oeapi_sampleLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_OEAPI_SAMPLE, "{2FB8F87B-D079-497D-8948-F2F060162392}")
};
<b>Coeapi_sampleModule _AtlModule</b>;
<b>BUT</b>
what I want (generated by compiler if we build in vc 6) is
<b>CComModule _Module;</b>
and i read that CComModule is obsolete now, but I have to use it anyway because <b>I have to code & build the project in Visual C++ 6.0</b> only not in Visual Studio 2005.
Please Help.
Thanks well in Advance!
dolly,
N,IN
|
|
|
|
|
The simplest approach would be to create an ATL project in VC6 with the same name, and then use the wizards to add the same objects and methods. This will fill in the boilerplate code for you properly (which is probably causing most of your compiler errors).
Once you get this constructed, copy/paste the method implementations from your VS2005 project into the VC6 version.
|
|
|
|
|
Hi Guys,
I am trying to wrap a LIB file (content unknown, but header file is available) into a DLL, so as to be able to use it in a C# App.
I have created a C++ DLL (MFC-Shared) with the following code:
#pragma once
#ifndef __AFXWIN_H__ #error "include 'stdafx.h' before including this file for PCH"
#endif
#ifndef _DEFINED_myProg_H_
#define _DEFINED_myProg_H_
#if _MSC_VER > 1000
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif
#include "resource.h"
#include "origlib.h"
bool GetList(CString *List1, CString *List2, CString *List3, int &iCount);
#include "stdafx.h"
#include "origlib.h"
#include "myprog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
extern "C" __declspec(dllexport) bool GetList(CString *List1, CString *List2, CString *List3, int &iCount);
bool GetList(CString *List1, CString *List2, CString *List3, int &iCount);
{
return bVal;
}
This DLL compiles ok.
So, i tried to test it in a MFC Test Application:
void CDLLTestDlg::OnBnClickedSearchbutton()
{
CString *Arr1, *Arr2, *Arr3;
int iDev = 0;
GetList(Arr1, Arr2, Arr3, iDev);
}
However, here I get a linker error:
LNK2001: unresolved external symbol "bool __cdecl GetList (class ATL::CStringT<wchar_t,> blah...blah...,int &)" (?GetList@@YA_NPAV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@00AAH@Z)
Could anyone please help me, where I am going wrong??
Thank u soooo much
|
|
|
|
|
You need to add extern "C" to the function prototype bool GetList(...) in your header file. The compiler is treating that as a C++ declaration, which means a C++ decorated name is being output to the linker. The extern "C" qualifier tells the compiler and linker to treat the function as having "C"-style linkage.
|
|
|
|
|
The linker says what you do wrong: interfacing ATL-Objects.
You need to have a plain interface with 'const WCHAR*' so there are no objects involved.
Greetings from Germany
|
|
|
|
|
Hi all,
I want to show Borderless About box on initially when i run my application.
I want this About box doesn't have any border,Close button or OK button.
I want it is automatically close after sometime (like 20 t0 30 sec) and then application run .
Please tell me how can do this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Your requirements define a Splash Window [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
"_$h@nky_" wrote: I want to show Borderless About box on initially when i run my application.
I want this About box doesn't have any border,Close button or OK button.
I want it is automatically close after sometime (like 20 t0 30 sec) and then application run
In and around Mumbai, we call this a splash screen. Search CP for articles on splash screen.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Visual C++ MVP
|
|
|
|