|
ginjikun wrote:
the "function1 exit" was printed after it encountered the error "The system cannot find the file specified.".
If that's the case, since the client seems to close the pipes successfully after each use, then let's look at your server code. I checked the for loop of that code, after the ConnectNamedPipes() are the next set of codes inside the same for loop? or is it set within a separate thread for every ConnectNamedPipes()?
|
|
|
|
|
I'm new in Window API,I'm able to take handle and put target program SCR in front and able to capture Title. I would like to capture content chars of Client-Area. I'm using AS/400 terminal emulator which use TELNET to communicate with AS/400. I need to know which SCR, user is using now so that I am able to judge whether my other program can activate or not.
There is screen to measure weight and to measure total weight. When user press F3 on the screen, I capture weight from weighing machine, when user press F6 on the screen, I summarize weight and put it to keyboard buffer.
Problem is I don't know which screen user is using so that whenever user press F3, PC program get weight from weighing machine. To prevent it, I must know which screen user is using, in case of different screen I don't activate PC program.
|
|
|
|
|
Capture TEXT mean
Say for example, I have NotePad to which I have type some chars.
I look for "PACKAGE Weight:" inside chars.
If I find it, this is SCREEN what I want(F3=capture weight).
I look for "Total Weight:" inside chars, that is the SCREEN what I want (F6
=summarize weight)
So how do I get SOME CHARS from NotePad using API ?
AS/400 screen, still same I believe (I can copy -> paste to NotePad
and it is not IMAGE, chars, I can copy it)
|
|
|
|
|
Hi all. Im going to try my best in explaining on what i need. I have a program that downloads an update to the package. I havnt gotten so good that i can update the file with out stopping or closing it but this is the only solution i could come up with. In order for the new program to work the old one has to download it. Then open it. I used ShellExecute() to open the new program. Thats not the problem though. Well now that i have the new program in the install folder, i need to kick the old one. So what im trying to do is get it to delete any files that opened it. I'll make a brief description.
<quote>
old-file.exe opens new-file.exe
new-file.exe starts up and deletes old-file.exe
I cant make it any simple than that. I thought by using argv that would be a start in figuring it out but i dont know how. Any suggestions? Thanx in advance!
|
|
|
|
|
Using VC++2005, created a Windows Forms Application.
On the click of a button I execute a method from another class which takes a long time to process. Part of this process is adding GRAPHICS to a panel on the main window. How to I trigger the paint event on the window from this method? Is it possible that this method is not allowing events to be processed by the window/form?
|
|
|
|
|
nrbracke wrote: Is it possible that this method is not allowing events to be processed by the window/form?
Yes it's possible.
You can, however, force the window to get an immediate WM_PAINT message by invalidating part
or all of the window (see InvalidateRect()/InvaliateRgn()) and calling UpdateWindow().
Also, check out RedrawWindow(), which combines the above mentioned operations.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
If I Invalidate() the windows goes blank untill the method finishes its processing instead of updating with the components I have already added. What is preventing the paint method from getting called?
|
|
|
|
|
You need to call UpdateWindow() as well, so a WM_PAINT message gets sent to
the window. That window would need to actually draw in response to WM_PAINT.
You really should be doing lengthy operations on a separate thread if you want your
UI to stay responsive. By not letting the message loop run, you're preventing the UI
from getting and dispatching the messages it needs.
You could also periodically pump queued messages during your lengthy operation,
something like this:
<span style="color: Green;">
MSG msg;
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (!AfxGetApp()-> PumpMessage())
{
break;
}
}
<span style="color: Green;">
MSG msg;
while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
is there a way to add a popup menu to ClistBox control?
thanks
|
|
|
|
|
Gofur Halmurat wrote: s there a way to add a popup menu to ClistBox control?
One way would be derive a class from CListBox and add a WM_CONTEXTMENU handler
to the class. In that handler, use TrackPopupMenu() to show a popup menu.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I created a class which derived from CListBox, and I added WM_CONTEXTMENU handler, there is a problem, how can i use TrackPopupMenu()in the class?
I have the menus ID = IDR_MENU1, can i call it in the class? if so, how?
thanks
|
|
|
|
|
Gofur Halmurat wrote: I have the menus ID = IDR_MENU1, can i call it in the class? if so, how?
What did you try??
Take a look at TrackPopupMenu() in the PSDK or MSDN.
Here's one example:
CMenu popupmenu;
popupmenu.LoadMenu(IDR_MENU1);
...do some menu initialization if necessary...
int Command = (int)popupmenu.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY, point.x, point.y, this);
...process the command... You can also use an appropriate window and catch the command message the normal MFC way.
You'd have to remove the TPM_RETURNCMD and TPM_NONOTIFY flags.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello Mark,
here is what i did in WM_CONTEXTMENU
<br />
popupmenu->LoadMenu(IDR_MENU1);<br />
int Command = (int)popupmenu->TrackPopupMenu(TPM_RIGHTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY, point.x, <br />
point.y, this);<br />
when i click on the listbox, appears a bar(like 10x100), does not appear the menu, what do u think about why it doesnt show the menu?
thanks
|
|
|
|
|
Without seeing your menu resource, I have no idea.
Maybe try the first popup like I showed in my example...
...(int)popupmenu->GetSubMenu(0)->TrackPopupMenu(...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Also make sure you're tracking your menu resources....
You don't necessarily need to load the menu every time you get a WM_CONTEXTMENU
message - you can load it once, maybe in the constructor.
If you do choose to load it every time, make sure you release it
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
you are right, there should be GetSubMenu(0)-> , otherwise, it doesnt work,
It helped me alot
Thanks
|
|
|
|
|
Hello,
I have a question again, it shows the popup menu when i click rightbutton, but, how can we create popup menu message?
thanks
|
|
|
|
|
Hello,
Finally I understood that it should be like this
popupmenu->LoadMenu(IDR_POPUP); <br />
int Command = (int)popupmenu->GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY, point.x, point.y, this);<br />
switch(Command)<br />
{<br />
case ID_POPUPMENU_EXIT:<br />
MessageBox("f***ing sh*t");<br />
break;<br />
}
thanks
|
|
|
|
|
Hehe...ah, the dreaded "f****ing sh*t" messagebox
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I want to sort array of data in ascending order associated with index.
for example
data 4 2 3 5
index 0 1 2 3
after sorting the result should be
data 2 3 4 5
index 1 2 0 3
can anybody help me with this problem
sarojsigdel
|
|
|
|
|
This code does not answer your question exactly but it should give an idea on how to do it:
#include <iostream>
#include <vector>
#include <algorithm>
using std::wcout;
using std::endl;
using std::vector;
using std::sort;
typedef vector<int*> pint_v;
typedef pint_v::iterator pint_i;
class SortPtr
{
public:
bool operator()(const int* v1, const int* v2)
{
return *v1 < *v2;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
int values[] =
{ 10, 9, 8, 7, 6, 5, 5, 4, 3, 2, 1 };
size_t count = sizeof(values)/sizeof(values[0]);
pint_v values_v;
for (size_t i = 0; i < count; ++i)
{
values_v.push_back(values + i);
}
SortPtr sp;
pint_i begin = values_v.begin();
pint_i end = values_v.end();
sort(begin, end, sp);
for (pint_i i = begin; i != end; ++i)
{
wcout << values[*i - values] << endl;
}
return 0;
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hmm, I get a 1 rating for my answer that actually sorted the array by its index (well, it was actually using pointer arithmetic. *i + values evaluated to the array index.) without a reason why!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
i think it's because you shouldn't do someone's homework, at least, not entierely. Moreover, you don't even use any of the formating html tags, so your message looks a little ugly...
by the way, it's just my feeling, i don't know the voter's reason though
|
|
|
|
|
I appreciate your comments and I have learned something from them. I have been beaten up physically (survived a t-bone auto accident) and mentally (depressed about becoming a senior). Sometimes, I question why I should even attempt to post replies here.
Thanks,
Geo
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
George L. Jackson wrote: Sometimes, I question why I should even attempt to post replies here
i wonder the same sometimes. but if you know your presence here is worth it, then don't care about the low rates, there will always some other ones to pull your messages up.
keep it up George. i've seen you to be a good member of the Managed C++ forum.
but try to follow the posting guidelines, especially when you post code samples (the <pre></pre> tag is dedicated for that). also, always think about the interrest of the OP. if a student is asking for a code, even though you can write it in a flashlight, would you do it, or try to convince him to listen at his teacher and try himself to do his homework ? one will never learn anything if no effort is supplied...
|
|
|
|
|