|
Here's how:
- Add an invisible pushbutton (
IDC_SET_CHECK ) to the form in View2. The IDC_SET_CHECK handler (add it using ClassWizard) should do what you want it to do to the view's list ctrl.
- From View1, get a pointer to View2 and post it the
IDC_SET_CHECK message, eg:
pView2->PostMessage (WM_COMMAND, IDC_SET_CHECK, 0); PS: A better way would be to make IDC_SET_CHECK a hidden menu command instead of clutering up the view's dialog resource with pushbuttons. I often have a menu resource called IDM_HIDDEN_COMMANDS that holds these commands.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
In a DLL, I have a class CPacketBase, which composed of a class CPacketBaseInitializer, like:
<br />
class CPacketBaseInitializer<br />
{<br />
public<br />
CPacketBaseInitializer();<br />
~CPacketBaseInitializer();<br />
<br />
public:<br />
static m_seqnum;<br />
static m_cs;<br />
<br />
static uint32 getNewSeqNum();<br />
};<br />
<br />
class CPacketBase<br />
{<br />
protected:<br />
static CPacketBaseInitializer m_static_initializer;<br />
}<br />
<br />
CPacketBaseInitializer::CPacketBaseInitializer()<br />
{<br />
InitializeCriticalSection(&m_cs);<br />
}<br />
<br />
CPacketBaseInitializer::~CPacketBaseInitializer()<br />
{<br />
DeleteCriticalSection(&m_cs);<br />
}<br />
<br />
uint32 CPacketBaseInitializer::getNewSeqNum()<br />
{<br />
uint32 ret = 0;<br />
EnterCriticalSection(&m_cs);<br />
ret = m_seqnum++;<br />
LeaveCriticalSection(&m_cs);<br />
<br />
return ret;<br />
}<br />
<br />
It seems that m_cs has never been initialized !!! It died in EnterCriticalSection(). It worked fine when I was using VS6 SP5, but after upgrading to VS.NET, it doesn't work.
|
|
|
|
|
Is there a simple tutorial on the internet on how to use CSockets that someone as dense as me could understand?
|
|
|
|
|
Hello,
I am using MS Flex Grid, an ActiveX control in one of my dialog boxes in my dialog based application. The OCX file for the ActiveX control is MSFLXGRD.OCX. The program works fine on my computer but doesn't work on other computers and terminates right before it gets to the dialog box with flex grid on it.
Please guide me as to how I should include the OCX file in the program so that it would work on any machine. Thank you very much!
Sincerely,
Anjum Gupta.
|
|
|
|
|
Use the Depened app, that is in your VS instalation... That app will help you with the librarys that you need for install your application....
Only you need to check if you have all the librarys, and the correct versions....
Best Reagards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
ummmmm
i think carlos means depends.exe
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
There are two issues..
1)If u just want ur Exe to run in other computers then its just enought if u register ur OCX file in the corresponding system.U can do it by Regsvr32.exe .But this is manual thing and u have to always do it by copying that OCX file and registering it.
2)The most elgant way of doing is to include this file (OCX) in the installion or setup file and u can run the setup..
If u face further problem do ask.....
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Hello,
Thanks for all the useful responses. I had one more question about .OCX files. You mentioned that I could update the registry manually .. or include it in the setup file. Unfortunately I don't have much experience with win registry. Could anyone please tell me how do I register the OCX file manually in registry ... and how do I go about including it in my setup program. I am making a setup program using Installshield for VC++ 6.0.
If you know I will also appreciate if you could direct me to some website where I can find info about adding OCX files into the registry manually and using the setup program and doing it automatically.
Thanks!
Anjum.
|
|
|
|
|
I want to save some stuff to the registry etc when the user shuts down the app using the right hand cross of the mainframe. Is there a preferred function? Theres onDestroy I see in the classwizard, and I can trap the WM_CLOSE in the mainframe. Which is "better" and why?
Thanks,
ns
|
|
|
|
|
the lil x on the mainframe bsically closes your app so you could catch the ExitInstance() of the app class or even the destructor of the app class
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
As Lauren mentioned, ExitInstance() is the right place to do app rundown stuff.
However, if you specifically want to handle clicking the close button (or Alt-F4, or "Close" from the system menu), write a handler for WM_SYSCOMMAND and handle the case for nID == SC_CLOSE. Be sure to eventually call the base class handler to ensure normal behavior (i.e. to allow the app to close).
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I don't know why I can't access VirtualDub's download website.
Anyone who had that program plx e-mail to me.(With source code)
Thanks a lot.
E-mail:zne@zne.com.cn
No pains, no gains.
|
|
|
|
|
There are a TON of mirrors, including the main one at Source Forge.
Google is your friend.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Christian Graus wrote:
Google is your friend.
Let's fire all teachers, for google is all you need.
- Jason
(SonorkID 100.611)
In the beginning, teachers taught the 5 W's: who, what, where, when, why. Now it's just a big damn G
|
|
|
|
|
Is there any tool like java2idl that can directly change MFC code into ATL code???
I am now modify some MFC code ,in order to change it into a COM .But there are lots of problems, such as,type dismatch, return value .
Anyone have some ideas about the steps how to proceed .
I will preciate it.
regards.
|
|
|
|
|
No tool will do this for you. First of all, if you've used any of the MFC classes like CArray and CString, you'll need to convert them. Second, if you want GUI in ATL it's totally different. Third, because of marshalling, you cannot send any type you want through any exposed functions, and of course there is the whole issue of the IDL, and the functions you choose to expose.
What sort of app is it ? Why do you want to convert it ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
But as I know , ATL can support MFC. Then could me use
the MFC Class like CArray and CString.
Because if I modify the software into COM ,the it can be used more freely .Do you think it is worth doing.
If I choose surpport MFC checkbox when create a new ATL project, could me just copy the MFC Class into ATL class?
|
|
|
|
|
Bliven wrote:
But as I know , ATL can support MFC.
Yes, and I don't know of anyone ever doing it. ATL and MFC have different goals and only a fool would merge the two.
Bliven wrote:
Then could me use the MFC Class like CArray and CString.
The fact that CArray is crap and std::String is usually perfectly alright being a side issue.
Bliven wrote:
Because if I modify the software into COM ,the it can be used more freely
I guess, it can be used from VB, etc.
Bliven wrote:
Do you think it is worth doing.
I have no idea. I asked you what your project was, and you've not answered me.
Bliven wrote:
If I choose surpport MFC checkbox when create a new ATL project, could me just copy the MFC Class into ATL class?
If you used MFC in ATL, it would just work. The question though is, is this a GUI app, and if so, why do you think it will help to rewrite it as a COM app ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Yes, it is a GUI app , just like foxmail .And it is a MFC app. And now my boss asked me to choose out the core code and organize it into a COM , without any GUI function.
Thus ,the core code as a COM can be referenced as a dll in vb, asp and so on. And the client GUI can be designed with vb.
I planned to rewrite it ,but the source code is so large and so obscurity . So I want to ask for a simple way to do this work .
|
|
|
|
|
OK, now we have some idea what we are talking about. Have you done COM before ? You should create an ATL project, preferably NOT with MFC, but I dunno if you're stuck with that for ease of porting, define your interfaces and then try to port your code across. There is no automatic way to do that.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
I plan to copy all the MFC Class ,Including GUI Class ,such as Frmae,View, to the Atl Project .And it can be complied successfully. Then I can further modify the Atl project based on that. I will add some interface in Atl project to call function instead of the automation message loop . In this way , I think I could let the Atl dll run in VB GUI,with his own GUI (Frame ,view,Dialog ) just loaded in memory and not shown.
This is my idea . What do you think of it ? I just want to get a general structrue ,and then I can modify the Atl code into more simple project,such as change Frame,view into other substitutes. In this way ,I can achieve my goal.
Expecting your advice.
Now I have copied all the MFC Class ,Including GUI Class ,such as Frmae,View,from the MFC Project to the Atl Project .And it can be complied successfully.
But when I attempt to register the DLL I get the following error:
Debug Assertion Failed!
Program: C:\WINNT\System32\regsvr32.exe
File: D:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC\APPCORE.CPP
Line: 85
Expression: ASSERT(AfxGetThread() == NULL);
So what does this really tell me and what can I do to correct it?
Any ideas???
|
|
|
|
|
Bliven wrote:
So what does this really tell me and what can I do to correct it?
The whole thing sounds like a disaster to me. Why would you want to compile all that GUI code into an ATL component ? I suggest you buy the book 'teach yourself ATL in 24 hours' and read it. Then do what I suggested - rewrite the business logic into an ATL component, reusing as much code as you can, but rebuilding nonetheless, so that you end up with only the code you need.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Thank you for your suggestion. Now I am following your suggestion to rewrite the business logic into an ATL component. Now there are some new problems.
For example. I have created two ATL object 'Student'and 'Teacher', and 'Student' is a property of 'ITeacher'.In idl, it seems the function can not return the user define class type.Then how can I get the 'Student' property in VB??
in idl:
[propget, id(1), helpstring("property Student")] HRESULT Student([out, retval] CStudent *pVal);
[propput, id(1), helpstring("property Student")] HRESULT Student([in] CStudent newVal);
E:\Programming\Study\ClassReturn\ClassReturn.idl(30) : error MIDL2025 : syntax error : expecting a type specification near "CStudent"
|
|
|
|
|
You can only return the types accepted by the IDL compiler. The easiest way in my experience to pass back data such as the details of a student is to pass it as XML. An XML string can contain as many different data items as you like, so long as they can be represented as text.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
CAtlArray is MUCH better than MFC array (thank god).
Also, for UNICODE/MLSU/ANSI applications, std::string has too many limitations. I have found that CStringT works much better in Windows applications.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|