|
Hey!!! are you a fool?
In how many forums have you asked this question? Can't you put it at the right place and be patient for a response? Currently you have posted it in the General Discussions forum (Here[^]), Windows Forms forum (Here[^]), Operating Systems / SysAdmin forum (Here[^]), Article Requests and Ideas forum (Here[^]), Visual Studio Programming Forum (Here[^]) and obviously here, which is the Visual C++ forum.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
It seems your repoert is perfect
|
|
|
|
|
You posted the same message on 6 forums!
|
|
|
|
|
have you got the solution to your problem.am also have this doupt.if you got send solution.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Have you looked at the RegisterDeviceNotification API? Maybe you could write a little app that
gets a notification of a device added and launches the appropriate EXE...
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Hi,
i have declared a structre S, which consist of int,float,double,long,char,WORD,DWORD varibles in it.Like structure S there are few other structures.I fill the data into structures by reading binary file m_file.Read((char*)m_s,sizeof(S));where m_s is an object of strucutre S.To validate the data,that is read into the structure object,i want to write the data in the structure object into text file in a formatted way,for that i need to format each and every element of that strucutre and write into the text file,instead is there any tool,that would dump whole data in the structure in a formatted way into a text file.please help me,if there is any ...
Thanks in before.
James.
|
|
|
|
|
Hi,
I am working in property Sheet wizard application. Here I am painting caption bar by own on OnNcPaint() and creating new minimize and close button. At some stage i want to disable/enable minimize and close button in caption bar. Can any one suggest?
Regards,
Rameshkanth
|
|
|
|
|
If you have handle to those buttons, you can always use EnableWindow .
|
|
|
|
|
When user try to stretch the window with any boundary of window it can resize accordingly. Please can any body help me for doing so?
Amit
|
|
|
|
|
Do you need to WS_THICKFRAME ?
|
|
|
|
|
thank you sir,
but what about the controls which hide when i try to make window small and create gap when try to make big.
amit
|
|
|
|
|
|
amitmistry_petlad wrote: When user try to stretch the window with any boundary of window it can resize accordingly. Please can any body help me for doing so?
I guess you want to do layout management...
See here[^].
|
|
|
|
|
I have a VC++ SDI motor control application that communicates with a motor control board over a serial cable. The application is multi-threaded. Communication with the board uses sending and receiving threads. I can send commands and receive status without issues. The design is a 2 pane, split-window application. Generally the leftmost pane is a FormView containing motor controls and the rightmost pane is a CScrollView to show motor status graphically.
The OpenLp feature of the App allows the user to manipulate sliders in the leftmost pane while viewing actual motor speed in the rightmost pane. This portion of the App is selected via a menu {Window/OpenLp} which starts a thread to periodically update the right pane by issuing motor commands to get status and calling UpdateAllViews() to show the results.
My problem: When I try to use a periodic call to UpdateAllViews(NULL) within this thread to accomplish the graphics in the rightmost pane it causes an immediate ASSERT.
Line: (ASSERT(pMap != NULL);
Routine: CWnd::AssertValid()
File:
|
|
|
|
|
Ack! Doc/view architecture really gets in the way here
Dalfxxx wrote: Q1: Can UpdateAllViews(NULL) be called in a thread that is not the main thread?
Not safely
Dalfxxx wrote: does anyone have a suggestion as to how I can accomplish the graphics?
You're going to have these problems using MFC because windows are associated with the thread they
are created in.
There's nothing wrong with updating windows on different threads BUT it's up to you to synchronize
access to GDI, which is NOT thread safe. This would apply even if UpdateAllViews worked.
Assuming you've made your painting thread safe, you could
1) Provide a direct method in the window classes to do redrawing
2) Use Invalidate()/UpdateWindow() combination to force the windows to be redrawn immediately via
WM_PAINT
3) Just use Invalidate() on the widows and let the UI thread post the WM_PAINT messages.
etc...
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Usually, I implement a special custom message in the mainframe window that will call UpdateAllViews and I post this message to the mainframe window from the other worker threads. This gets the 'porocessing' of the views into the main UI thread - away from the worker threads.
|
|
|
|
|
I completely agree. Much of my personal window refreshing is realtime multimedia-related so
I'm pretty used to multithreaded GDI The postmessage is certainly the easiest and safest
IMO.
Cheers!
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Mark,
Thank you very much for your reply. You have enabled me to take a different approach and stop banging my head against the wall. I have tried replacing the UpdateAllViews() call with a call to InvalidateRect(NULL,NULL,TRUE). I think that this is what you suggest in (3) and it appears to work - although it appears to expose some other problems which I can probably take care of.
Could you elaborate a bit on your comment:
"Assuming you've made your painting thread safe"?
My OnDraw code (which I don't call directly) uses MoveTo(), LineTo(), TextOutA(), CreatePen(), etc. I can visualize two or more threads using this code because of WM_PAINT. Is this what you meant? Can I make the OnDraw code "thread safe" by using a CriticalSection? If not, what would you suggest?
Thanks Again,
Stan
|
|
|
|
|
Dalfxxx wrote: Could you elaborate a bit on your comment:
"Assuming you've made your painting thread safe"?
I meant if you are calling your painting method(s) directly from multiple threads then any GDI
calls there need to be synchronized. A critical section works fine
If you're relying on WM_PAINT (which is the case if you use InvalidateRect() to mark the window
for repainting) then you should be ok. All of those messages will go through your UI thread.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Hi, I got a question about Named pipe question on WIndows wondering anyone can help me.
I am doing some studies for Named Pipe and I want to try to make two processes on Windows talk to each othe. From MSDN I saw this example
http://msdn2.microsoft.com/en-us/library/aa365588.aspx
With minor changes I got it (server and client)working on XP using VS 2005 Express.
My questions are,
1. The named pipe is defined by :
LPTSTR lpszPipename = TEXT("\\\\.\\pipe\\mynamedpipe");
Since named pipe is part of the file system, how can I actually see the file. I think in UNIX, you can actually use "ls " to see the pipe file, can I do that in Windows?
2. I am new to this, but if named pipe is part of the file system, what happens if the server crashes? the file will still be left out there? worst, power failure?
Thanks for you help
|
|
|
|
|
mhp130 wrote: Since named pipe is part of the file system, how can I actually see the file. I think in UNIX, you can actually use "ls " to see the pipe file, can I do that in Windows?
I don't believe it's part of the file system. Named pipes are used for interprocess
communication. Thanks to "opaque" handles, the common ReadFilexx/WriteFilexx APIs can be used
for pipe communication (as well as sockets). Anyway, the name doesn't specify a file.
It's used to uniquely identify a pipe by combining a server/machine name with a unique name.
mhp130 wrote: what happens if the server crashes?
You'd probably get a broken pipe (or other) error on the next read/write operation.
I suppose if we were meant to see the data between endpoints they would have called them
perforated pipes
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I created an application that contains a dialog box and a menu. This dialog box contains a tab control with two tabs. Each tab contains a dialog box. How can I associate the menu with the dialog boxes on the tab control?
Thanks
Trevy
|
|
|
|
|
Trevy wrote: How can I associate the menu with the dialog boxes on the tab control?
Only Popup windows can have menus.
AFAIK if it's on a tab control then it's not a popup window.
|
|
|
|
|
I have a class A and it has x,y and z integer attributes
I have created a list sequence container which has a type A
list<a*> alist
I want to sort the elements in this list according to y value. How can i do that?
alist.sort() only sorts the elements according to the first attribute defined in the constructor.
|
|
|
|
|
You have a number of options. The first is to define an operator < for your class:
bool operator<(const A &lhs, const A &rhs)
{
return lhs.y < rhs.y;
}
You would make it a friend of class A if it needs access to private members of the class.
Another option is to define a predicate function and pass it to the std::list<...>::sort function. This option would enable you to have multiple sort orders. Example:
class A
{
public:
static bool SortByYPred(const A &lhs, const A &rhs)
{
return lhs.y < rhs.y;
}
};
Now call std::list<...>::sort like this:
alist.sort(&A::SortByYPred);
mehmetned wrote: alist.sort() only sorts the elements according to the first attribute defined in the constructor.
The constructor has nothing to do with sort order.
Steve
|
|
|
|