|
I migrated from VC++.Net 2002 to 2003 recently. I see that they have standardized a lot of headers .
My question is regarding this particular prolem I am not able to solve.
In 2002 , I had created a derived class from a filebuf , and had written a function called dump which will write contents of file into the console.
In my application I connect this class to cout , using the following syntax
cout = &buffer ,
buffer is instantiated as static with file desc as 1 .
THis particular setting works in 2002 but in 2003 it gives me an error as operator = not defined.
Why was this change implemented? and Is there a workaround for this ?
I have run out of ideas . I tried to use rdbuf() but it doesnt work either
|
|
|
|
|
cout (and cin, cerr) is generally defined to be a constant. Using operator= on this would be incorrect for several reasons that I won't even get into.
What exactly are you trying to do?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hey there . I want someway to connect a derived filebuf class to connect to the cout.
I try the following code
ostream file(&filebuf class)
cout.rdbuf(file.rdbuf())
These 2 lines shld connect to the cout buffer , isnt it? or am I wrong somewher?
Thanx
Darshan
|
|
|
|
|
To elaborate more clearly, there is a fileid() function in filebuf which takes an int argument. My derived class populates it with 1 , so that now its has stdout file desc. Also the constructor does an AllocConsole to open a console in an MFC application.
Now in 2002 a command like cout = &cfilebuf works
but in 2003 it does not work . I see now its a constant . But I still need to connect the buffer.
So I used the above code . I dont think that works either. Just Wondering how sync() in filebuf works?
Thanx again
|
|
|
|
|
If I understand you correctly, you are trying to open a console window from an MFC app and use it for output?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
You should be able to get there from this article. cout should work for it, but if it doesn't, you just need to open a new ostream to the allocated console and use that instead of cout.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
hi
I want to set Account locking duration and Threshold of Windows OS programmatically. we can set this manually in (controlpanel\ administrative tools\localsecurity policy\account policies \account lockout policy\)
i configured windows password length & max password age through NET ACCOUNTS dos command.
eg:C:>net accounts /minpwlen:12 (sets min password length as 12 char)
so is there any similar way to set account locking duration & threshold programmatically?
thanx in advance
-- modified at 14:38 Tuesday 23rd May, 2006
|
|
|
|
|
Hi !!!
Can me somebody tell, how to play audio files in C++?
Thanks.
By.
-:KNOX:-
|
|
|
|
|
hi,
C++ doesnt provide classes or methods to play audio files. you have to use a library, like OpenAl.
georg
|
|
|
|
|
I'm porting a C++ DLL from W2K Server to 2003 Server, and the data_seg(".myglobal") segment (with "/SECTION:.myglobal,rws" linker option) is no longer "sharing" data. The DLL is called from both a Windows Service program and from a VB application. On W2K, you can start the Service, start the VB app, and they both share the data in the .myglobal segment. On 2003, that no longer works - the data is no longer shared: the VB app gets it's own copy.
The Windows Service program is written so that it can be run from the command line for testing purposes and that still works, i.e., starting the Service program from the command line then starting the vb app has no problem - they share the data just fine.
Any suggestions on how to share DLL shared data between a Service program and a User program on 2003 Server? I've tried using the default data_seg("global") with no luck, and I don't know what else to try.
Thanks!
|
|
|
|
|
If my project includes 85 dlls how to enable manifest on for some of them. If you have manifest it always using COMCTRL32 vesion 6 for all projects. I tried to unload version 6 and load version 5 but it didn't work Microsoft keeps always 6 in the memory if you have manifest. Is the any way to customize usage of manifest per project?
|
|
|
|
|
The wizard generated code for MFC apps adds code to stdafx.h to tell the linker to add the 6.0 manifest specific information.
You can make sure you don't have this code for the dlls where you want to load the pre-6.0 dll. I would think that you need to load the pre-6.0 before loading the 6.0 one.
gmileka
|
|
|
|
|
Is it only for VS2005 MANIFESTDEPENDENCY
|
|
|
|
|
Hi,
I need to implement my own virtual driver which pretends to be a serial port. Other application would know better if it was a real port or not.
I know that there are programs that alreaddy do such a thing. Just Google to find them
but i need to write it myself.
Does anybody have a clue where to begin or have the correct search criteria to find it myself in google.
Anyhelp would be very appritiated.
codito ergo sum
|
|
|
|
|
To get you started, you will need to open the serial port with shared access (instead of exclusive) from both ends. The best way to do this is to write a serial port class (or take one of the many implementations on this site) and modify the OpenFile call to use the flag for shared access.
Your application (the code connecting to the serial port) and the simulator (the code pretending to be on the other end) will both use this class and you can handle your data accordingly.
An alternative (and easier) solution is to take a serial cable and connect it from 1 port on your machine to another one. Have the application and simulator each open 1 end of and behave normally (basically, creating a loopback using hardware).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
thanks for the respons. But I need to write the driver not the using application. Let me explain a little better.
We have already software that works with a modem. This software can't be changed its an "exe". The virtual serial driver emulates a serial port or even a modem but itself connects through ip for instance or whatever.
A have search a little further on google and I think i need to implement a DEVICE DRIVER.
Is this the path to go?
codito ergo sum
|
|
|
|
|
BadKarma wrote: We have already software that works with a modem. This software can't be changed its an "exe". The virtual serial driver emulates a serial port or even a modem but itself connects through ip for instance or whatever.
Emulates the serial port over IP? Do you mean you will just be passing the software the data it would receive over the serial port (if it was actually connected to one) via some other means?
BadKarma wrote: A have search a little further on google and I think i need to implement a DEVICE DRIVER.
Is this the path to go?
You could go that route, though, that would be my last resort. Perhaps a bit more about the requirements you need to fill would narrow down the problem.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Are you absolutely sure you must do this? Developing a device driver is time consuming, especially so if you do not have prior experience. I'm currently fiddling with device drivers right now, and I can tell you that it's far more complex than writing a user space app.
If you absolutely must write a device driver, I suggest you get a copy of Programming the Microsoft Windows Driver Model (ISBN: 0-7356-1803-8). What you need to do is to write a serial port minidriver - a driver which implements a serial device driver skeleton.
--
100% natural. No superstitious additives.
|
|
|
|
|
hi guys..
I badly need help. I need to iintegrate a progress bar in my program but is not able to get a gud code for progress bar in win32..
plz help me!!
thx
|
|
|
|
|
Hello! i'm needing to detect control + key combination on my PreTranslateMessage Method of a view i have. My code is as follow:
<br />
<br />
BOOL CTextView::PreTranslateMessage(MSG* pMsg) <br />
{<br />
long SOMETHING= 0;
<br />
if (pMsg->message == WM_KEYDOWN &&<br />
pMsg->wParam == VK_SPACE && <br />
pMsg->lParam == SOMETHING)<br />
{<br />
}<br />
<br />
return CScintillaView::PreTranslateMessage(pMsg);<br />
}<br />
<br />
I'm needing to know if this is the correct approach and if i'm right, wich value should i check lParam for, because i'been looking at the msdn library and i don't get it!<br />
<br />
Thanks a lot, <br />
Emmanuel<br />
<br />
Emmanuel Logan Oga
|
|
|
|
|
I Have solved this problem this way:
Thanks to a previous post!!
BOOL CTextView::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_KEYDOWN:
{
switch (pMsg->wParam)
{
case VK_SPACE:
{
if (GetKeyState(VK_CONTROL) & (1 << sizeof(SHORT) * 8 - 1))
{
CString szAutoWords;
for (long n= 0; n < g_vszKnownWords.GetSize(); n++)
szAutoWords+= g_vszKnownWords[n] + _T("\n");
szAutoWords.MakeLower();
if (!szAutoWords.IsEmpty())
GetCtrl().AutoCShow(0, _tochar(szAutoWords));
return TRUE;
}
}
break;
case VK_F5:
case VK_F9:
OnExecute();
return TRUE;
}
}
break;
}
return CScintillaView::PreTranslateMessage(pMsg);
}
|
|
|
|
|
I have a picture control(static control) on my dialog box. then iam browsing for an image(any type like jpeg,bmp..) by using a browse button on my dialog box and i want to display the selected image in the picture control. the image should be fit in the control.
Please do explain with example?
Thanks in advance,
Regards
Kumar_Windows
|
|
|
|
|
|
kumar_windows wrote: hen iam browsing for an image(any type like jpeg,bmp..) by using a browse button on my dialog box and i want to display the selected image in the picture control. the image should be fit in the control.
could you tell me Which Interface or Api are you using to Display JPG,PNG format in PictureControl, as pictureControl only understand Bitmaps
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|