|
Use references. Add a member to "the other class" of type reference (ie., CStringArray& m_array). Pass the real array in your dialog class to the class's constructor:
CMyDlg::OnWhatever()
{
COtherClass oc(arrayFromFile);
...
}
...
COtherClass::COtherClass(CStringArray& array) :
m_array(array)
{
}
Regards,
Alvaro
There are no stupid questions, but there are a lot of inquisitive idiots. -- despair.com
|
|
|
|
|
Hello again, I was wondering if someone could inform me how to display a bitmap and text on a button, if that is possible?
I would at least need to know how to get a bitmap displayed on the button, and could just add the text to the bitmap, if needed...
Also, because I am using API, I would appreciate a no-mfc version of how to do this. Thanks.
God is dead. - Nietzche
Nietzche is dead. - God
|
|
|
|
|
I need to know as this filter works, like valued to the users, where entrance the parametros of validation, etc. I need to install it in a system that validates the users while they are within the site, allowing or denying access against its privileges, thanks!!!!
|
|
|
|
|
I'm programming in visual c++ (vs6) for a while now, and I always get the same difficulties with transferring projects from one machine to the other.
I have 2 machines, both win98. But the first is win98/osr1 in english, the latter is win98/osr2 in dutch.
Transferring projects will always result in resource exceptions. Probably, opening an english resource (...and the whole project) on a dutch machine is impossible. I have to delete half of my project an rebuild it again, loosing much data.
Is there some sort of way that ignores languages in resources? Or maybe a way to kick out all language related problems all together (even better)?
btw. Next to US-english stands this: [standard]. In my opinion, this US-english is not a standard, far from it...
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Hi all,
I am cooding an application for sending key-strokes to an other application. For example, sending a ctrl+C to to the target application. Because the target application will be non-MFC application(e.g Java applet, OpenOffice...etc), it may not be able to use the WM_XX message.
Do you have any great idea to do so?
Cheers,
Tony
Enjoy Coding.
|
|
|
|
|
|
Hi,
is there a Win32-API with which I can programmatically remove a usb-device (especially usb-drive)?
Any help appreciated
Rainer
|
|
|
|
|
I want to send the pointer of my myCDialog from its OnClose to the parent View. PostMessage has two UINT args I can use. Can I do:
In OnClose()
p_Parent ->PostMessage(myMSG, UINT(this),0)
and on the receiving side in the parent:
OnMyMsg( UINT n1, UINT n2)
{
myCDialog* dlg = (myCDialog*)n1;
}
Appreciate your help,
ns
|
|
|
|
|
Yes you can.
<br />
p_Parent ->PostMessage( myMSG, WPARAM(this),0 );<br />
John
|
|
|
|
|
But don't forget that the data that the pointer points to needs to remain valid while you are processing it! i.e. don't do
void CMyWindow::OnSomeMessage()<br />
{<br />
CString strData = "Hello";<br />
m_pMyOtherWindow->PostMessage(WM_STRING, &strData);<br />
}
As the CString will have been destroyed by the time you come to use your pointer to it. In this instance, use SendMessage() instead.
|
|
|
|
|
My pointer is a member so its not local so I'll post and not send, but thanks so much for making me aware of the temporariness of the passed in variable...
Appreciate your help,
ns
|
|
|
|
|
Yes. Good Point! I was thinking about that. There will be a problem if the dialog goes out of scope.
John
|
|
|
|
|
I have SP5 installed for VS6.0. Now, when I build a project that I've been working on for 3 months, it blows up when it is launched outside the debugger. It blows up at lauch time - the debug version gives me a crash address of 0x00000009, which isn't even in my code yet!. If I compile it on a machine without SP5, it works fine.
Has anyone else seen this?
|
|
|
|
|
Have you tried rebuilding the whole project?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I just installed SP5 for VC++ 6, and everything *seems* to be working fine.
|
|
|
|
|
Indeed mine seemed fine for a while.
I just had to remove dev studio, and re-install it, and apply service pack 4. Everything is back to normal now.
|
|
|
|
|
My program is behaving differently when I link with MFC statically vs. when I link with MFC as a shared DLL. (In both cases I an using a debug build, so this is not a debug/release issue.)
The first issue I noticed is with the CRectTracker. When I use a RectTracker while linking with a shared DLL everythink works correctly. The cursor changes when over the rect to a cross and the user can move the rect around the screen. But, when linking with with static MFC the rect tracker does not behave correctly. After the rect tracket is displayed, moving the cursor over the rect makes the cursor disapear. It does not change to the cross, it just disappears when over the tracking rect.
Any ideas what I am doing wrong? Any ideas why this is and what I can do about it? Thanks!
Craig Smith
|
|
|
|
|
Try a service pack (or not, see my most recent thread...)
I know there were problems with sockets and statically linked MFC, which was supposedly fixed in SP5.
|
|
|
|
|
Sir i am setting the options of the ICMP Packet using the function below. As ttl=0 so packet should not be sent but it is not happening packet has reached its destination.
int ttl=0;
(setsockopt(sock,IPPROTO_IP, IP_TTL, (char *)&ttl, sizeof(ttl))
// Send the echo request
if (sendto(sock, (const char *) &echo_req, sizeof(ECHOREQUEST), 0, (SOCKADDR *) &sin, sizeof(sin)) == SOCKET_ERROR)
//plz help me
Reply me soon
|
|
|
|
|
Have you checked the error code returned by setsockopt? According to the MSDN, the TTL does not have to be supported. Also, if your destination is local then the packet may not have to go through any routing devices, and so the TTL wont have any effect (it is 'hop' based, not time based - with a hop being the passage through some routing device)
|
|
|
|
|
Hi there,
I have a problem with a global instance of a CArray based class (named CPlugInArray), my environnement is W2K / VC 6 / SDI application.
I define my variable in the application class (named CMyApp), then make it global.
In CMyApp::InitInstance, I add elements throught CArray::Add member function without any problem. Further in CMainFrame, I parse these elements without problems, but when I choose an item in my menu, the callback function (localized in CMainFrame) parse again elements but the first element address has slighly changed and I can't retrieve data, VC 6 even crash when I reach a break-point near elements calls !!
Does anybody has encounter the same problem ? Does CArray based global variables are not recommended or allowed ? Should I use a CPlugInArray * global symbol instead ?
Thank you for your answers ! I really need it !
Cheers,
Florian
|
|
|
|
|
pimOOsse wrote:
? Does CArray based global variables are not recommended or allowed ? Should I use a CPlugInArray * global symbol instead ?
First, you could use member variables of the Application. These can be accessed anywhere via <code>theApp.m_Member .
Second, you should really try to use the std::vector. After all, its the standard
Third, do you work with dangling pointers after having used CArray::Add() ?
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Thank you for your answer jhwurmbach,
I know I could use member variables of the application, but I cmust confess that it's easier to access global variables with CMyApp::m_MyVar than calling AfxGetApp(), casting the pointer into CMyApp * then accessing the variable
But, it I continue to have such problems, I'll follow your advices ! Overall I never tried std::vector, so it should be a good occasion to have a look at
|
|
|
|
|
You are trashing memory somewhere that is trashing the CArray data. You can use CArray with a global. There is no need to switch to std::vector, that wouldn't solve anything and is pointless in an MFC application if you aren't using STL's advanced features.
Somewhere, you just have a bug that is trashing memory. Chances are you are overrunning the end of an allocated array somewhere.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi Tim,
Happy to read that there is no problem to use such object in a global manner
I'm also sure that someting wrong is occuring in my application but I don't know where yet The GetSize() mmeber function return the right amount of elements but it crashes as soon as I try to debug what happen.
I know that I'll spend some time in debug But it must work
Cheers.
|
|
|
|