|
What do you mean separate lines? Do you mean one line at a time or do you want to skip lines?
ReadString();
Kuphryn
|
|
|
|
|
Anonymous wrote:
how to use CStdioFile to read separate lines from file like ifstream?
forget about it! use the ifstream!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I have a C++ class that allows declaration of static functions , but I needed to declare static variables also . As for example I need to access the current object in a static timer procedure as I needed to do some Initialization .
I did the following in my Class definition
class MyClass {
public :
-
static MyClass *thisPtr;
-
};
I got a Linker error . I am not able to figure out the mistake here . Please help
|
|
|
|
|
You've to initialize your static variables outside your class.
This could look like
MyClass* MyClass::thisPtr = NULL
|
|
|
|
|
MyClass* MyClass::thisPtr = NULL
This really works but I am failing to understand the significance
of MyClass*. I have already declared the type for thisPtr in my class ?
Thanks for the help
|
|
|
|
|
act_x wrote:
I have already declared the type for thisPtr in my class ?
Sure, but when initializing it the compiler needs the the type again. I think it's to do with the handling of static variables - they aren't assigned to memory space together with class variables - they're "on their own".
But that goes to much into theory for me ... everytime I need to know s.th. about that I'm asking my C++ compendium
|
|
|
|
|
|
Static member variables are equivalent to global variables. Putting it inside a header file basically announces to the CPP files (that include it) that it exists and what its type is. But it's not until you define it inside a CPP file that it gets instanciated and the linker can then retrieve its memory address.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
In the .cpp of the class (say MyClass.cpp ) define thiPtr :
#include "MyClass.h"
MyClass * MyClass::thisPtr=0;
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I am testing the sample Cir2 ActiveX control given by MSDN lib.
step 1: I inserted that Ctrl in "ActiveX Control Test Container"
Then If I click in the conrtol it is working. (regonize the mouse down event and displays filled circle)
step 2:
1. I inserted the same in MS-Word or PPT.
2 Click on the contol. Results nothing.
3. GoTo SlideShow or use popup/edit/ then click on contol.
then it works.
Question:
How can I do here without using edit or shifting to slide show?
thanks,
regards,
ajitd07
|
|
|
|
|
Hi,
I created a Simple MFC based Active-X control thro Wizard, for testing. i.e MyOCX.
In CMyOCXApp I put a AfxMessageBox("InitInstance") inside InitInstance() and in ExitInstance(), I put AfxMessageBox("ExitInstance")
Case 1: Test in "ActiveX Control Test Container"
Step 1: Insert MyOCX Ctrl in the container.
Result: message Box Poped "InitInstance"
Step 2: Insert Another MyOCX Ctrl in the same container.
Result : MessageBox in InitInstance is NOT popped.
Step 3: Delete the 1st inserted control.
Result : MessageBox in ExitInstance is NOT popped.
Step 4: Delete the 2nd inserted control.
Result : MessageBox in ExitInstance is popped.
"ExitInstance"
Question:
Why it is Not poping up "InitInstance" MessageBox every time when I insert? also "ExitInstance" every time when I delete?
Case 2: Test in "MS Office products: PPT and MS-WORD"
Step 1: Insert MyOCX ctrl in PPT or MS-Word.
Result: message Box Poped "InitInstance"
Step 2: Delete the inserted control.
Result : MessageBox in ExitInstance is NOT popped.
Step 3: Close the Application (PPT/MS-Word) Completely
Result : MessageBox in ExitInstance is popped.
"ExitInstance"
Question:
Why it is Not poping up "ExitInstance" MessageBox Imeediatly When I delete the control in the container?
Where I will get the answer?
Thanks and regards,
ajitd07
|
|
|
|
|
In VC++ 7.0 classes keep disappearing from the Class View. The files are still there in the project but do not show up in the Class View.
How do I get it back into the class view?
In previous versions all you had to do was delete the .clw file and the Class Wizard would recreate it and fix any problems.
|
|
|
|
|
don't know if this will work in VC++ 7, but in VC++6 it does:
you can just modify and save the header file... (it's fastest than deleting the *.clw)
hope this helps...
|
|
|
|
|
I'm using ::TextOut() to render text to a printer DC, and on most printers, this works fine, but I don't know where the font information is coming from! This is fine in most cases (by dumb luck), but on some printers the chosen font is Wingdings!
So my Q: How do I set the font for TextOut() ??
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
From MSDN: The TextOut function writes a character string at the specified location, using the currently selected font, background color, and text color.
So all you've to do is calling SelectObject, passing a handle to a former created font object.
|
|
|
|
|
ahh... ic
thx!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
This is more of a design question. I have a CDialog derived window (several) and when I spawn them I push_back their pointers on a vector. This vector is externed so the CDialog guys can see it. Now when I right click on any one of these windows I need to get the pointer of the CDialog I had stored on the vector. How do I get this to happen? Alos when i right click on this control, I want a context menu (popupmenu) to materialize.
What is the difference between the handler written to capture WM_CONTEXTMENU and WM_RBUTTONDOWN - both operate on a right mouse click.....so if I write handlers for both messages which one runs?
Appreciate your help,
ns
|
|
|
|
|
I wrote a CDialogManager class for this very purpose. (I don't have an article yet though.) Basically, what I do is put the vector of dialogs in their own wrapper class (CDialogManager in my case), and set up public methods to get at what I want. Then in your dialog that you want to access one of the ones in the vector, you merely do something like:
CMyDialog* pDialog = &MyManagerClass.GetDialog(iDialog);
Now, pDialog-> is ready to go.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
So when I am right clicking the dialog, how does it know what the iDialog is to call GetDialog with? AM I missing something really obvious?
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
What is the difference between WM_CONTEXTMENU and WM_RBUTTONDO
WM_RBUTTONDOWN is specifically for a mouse button click. WM_CONTEXTMENU is sent for a right-click, Shift+F10 keypress, or App key keypress (basically, any of the ways to get a context menu).
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
hi,
how to use CStdioFile to read separate lines from file like ifstream?
|
|
|
|
|
why do i get this message wenn i do this:
shutdown(sock, SD_BOTH);
my includes are:
#include "stdafx.h"
#include "stdio.h"
#include "tchar.h"
#include "process.h"
#include "crtdbg.h"
|
|
|
|
|
hello
you can try
"#include winsock2.h"
i hope that help you
|
|
|
|
|
lol,
thnx
|
|
|
|
|
I think you need to link with ws2_32.lib
You may need winsock2.h also, but I'm not sure.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|