|
I have to load multiple images like from 10-20, also the no. of images is not known it varies with problem, so i thought use for loop
convert integer to char using sprintf then concatenate it with the format like---.jpg, .bmp etc
char fmt[]=".jpg"
for(int i=1;i<=15;i++)
{
sprintf(str,"%d",i);
str=strcat(str,fmt);
CImg<double> image("C:/Users/Shree Hari/Desktop/trial/str");
CImgDisplay main_display(image,"Image",0);
}
now that str will vary from
1.jpg
2.jpg
3.jpg
and so on and my database is also like as above mentioned
but it is not reading str!!!!
Plzz help me in this
|
|
|
|
|
Hello,
I've been trying to solve that problem for some time now and I'll be very grateful to anyone who can suggest a solution. The problem is a little tricky but I hope I'll be able to explain it clearly.
I have an application which might need to notify the user of an event even if it's not focused at the moment or is minimized. Think of something along the lines of an app that copies files for 5-6 minutes and needs to say 'Your files were copied' at the end, but the user has switched to writing emails in the meantime. I don't want to grab the keyboard focus because he might be doing something like writing in notepad in which case he'll be randomly pressing hotkeys on my dialog instead of writing to notepad. But I can't figure out how to do this properly.
Right now I use this code (from my main dialog class):
SetForegroundWindow();
By calling SetForegroundWindow() my dialog comes to the foreground (or flashes - but I don't know how Windows decides which of the two) and sometimes will steal focus which I don't want, but there are many problems if my dialog is also minimized. In this case the taskbar icon of my dialog will seem to become active on the taskbar, but my dialog won't show itself (it'll remain minimized but receive keyboard focus it seems). If I uncomment the other two lines, then it solves all problems with minimizing as it first unminimizes the dialog, but it _always_ steals focus which I don't want.
My second problem with the main dialog being minimized is I also create a dialog containing some information about the event and I display it with DoModal, and if I call DoModal while the main window was minimized, when the user switches to my program the new dialog created with DoModal is shown but the main dialog is not. Any way to fix that?
So it's all very complicated and I'm not sure how it's supposed to be implemented. Again, all I want is to notify the user without stealing keyboard focus, even if my dialog is minimized at the time. Do I unminimize my dialog? How do I prevent it from stealing focus then?
Any help will be greatly appreciated!
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Instead of SetForegroundWindow, why not install a system nofitication icon[^] while your dialog is doesn't have focus. Then you can display a balloon tip[^] when you want to tell the user that you're done.
There are several Code Project articles on the subject here[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for the reply, this is interesting. I didn't think of doing that, but it'll certainly solve the problem.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I'm thinking of displaying an icon on the tray, and when the operation is done a balloon tooltip emerges and notifies the user. Optionally when the user clicks on it the focus is switched to my app.
The documentation seems a bit complicated, especially about which flags need to be used in the uFlags field of NOTIFYICONDATA. I see I need NIF_ICON and NIF_INFO for balloons, but do I need NIF_TIP also? Can you help me by telling me which flags do I need to set?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I want to read mac address of system from switch cam table. But sometime switch takes long time to learn the mac address of newly connected system on LAN. Have you any idea so that switch learn mac address immediately? Can ping the system helps me?
Thanks.
|
|
|
|
|
I worked on a problem at my previous employer where the switch CAM table[^] was not being updated during high-load network traffic. When we unplugged a CAT-5 cable and moved it to another port, the switch was still routing packets to the old port with nothing plugged in. Perhaps you are having a similar problem?
navneet1985 wrote:
Can ping the system helps me?
Possibly but maybe not. Its difficult to explain but I can try. There are several scenarios to consider:
1.) If the computer your sending the ICMP packet from already has MAC entry in its ARP cache then it will send the packet with the destinatation set as the MAC address in the ARP cache. If the network switch does not have an entry for the MAC address inside the CAM table the packet will be dropped/ignored, switches do not ARP for you.
2.) If the cam-table on the network switch has a MAC entry but for some reason it is incorrectly mapped/poisoned then the network packet will be incorrectly routed.
3.) If the computer your sending the ICMP packet from does NOT have an entry in its ARP cache, the operating system will send an ARP request for you. The ARP response from the remote machine *should* update the cam table in the network switch.
Essentially the network switch will simply perform a lookup in its internal CAM table and route the ICMP packet to whatever port it associates with the MAC address. It updates this entry when it sees an ARP packet.
I would recommend manually sending an ARP request[^] and ask for the MAC address. When the switch recognizes the ARP resonse packet it should update the CAM-table with the new MAC address.
During my experiments with various switches I noticed that some of them would not update the CAM-table during extremely high network traffic. Not all switches are created equal, you get what you pay for... the switches which exibited this behavior were all unmanaged inexpensive "dumb switches".
Hope this helps,
-David Delaune
|
|
|
|
|
How to drag and drop between CListView and CScrollView?
|
|
|
|
|
The standard drag and drop system should work fine for these controls.
Are you having problems getting the events to fire, or in putting the code in the event handlers?
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
I need a good sample code to reference. Could somebody tell me which source code is suitable for me to study?
|
|
|
|
|
|
Hi!
Created application is working toooo slow, looks like there are a lot of memory leaks, there are a lot of pointers. So, please, can you advice some effective tool for run-time errors and memory leaks detection in Visual Studio C++?
Thanks!
|
|
|
|
|
In the past I've been using AQTime[^] which works pretty well to detect memory leaks and bottlenecks. But it is not a free tool.
For run-time errors, what do you mean by that exactly ? If you have a run-time error, your program simply stops working...
|
|
|
|
|
|
looks like it is really useful one.
Thanks!
|
|
|
|
|
There is a CTabCtrl on a PropertyPage, size of the CTabCtrl is 450x200 in resource design view.
Now I want to add several dialogs (child of the PropertyPage) as contents of the CTabCtrl.
Size of all child dialogs is 410x150 in resource design view.
It sounds OK for CTabCtrl (450x200) containing dialogs (410x150) in size.
But acturally dialogs are much larger than client area of the CTabCtrl at application runtime, I have to resize dialog size to much smaller in resource design to fit the CTabCtrl - I think it is a bad way.
I realize that dialog and PropertyPage use different unit (or something else).
My question is: how to change dialog unit to let it have same unit as PropertyPage (at runtime or design time), so that the CTabCtrl (450x200) can contain original dialogs (410x150) properly?
|
|
|
|
|
What about the fonts? Are you setting the font on either the dialog or tab control?
The thing that comes to mind is this curly little 1 liner (hidden away in the help for MapDialogRect):
Microsoft wrote: In most cases, the base units for the dialog box are the same as those retrieved by using the GetDialogBaseUnits function. If the dialog box template has the DS_SETFONT style, however, the base units are the average width and height, in pixels, of the characters in the font given by the template.
In other words, if no font is set for the dialog box, the dialog units are based on the size of the system font. If however, a font is specified, then the Dialog Units are based on the size of _that_ font.
|
|
|
|
|
Can anyone point me to documentation on the possible settings for
dwStyle, dwTabbedStyle, dwControlBarStyle in
CDockablePane ???
I cant seem to find them online anywhere.
I'm ultimately trying to either make the tab bar for the Console Window (in the default MFC app) disappear, or at least bring the tabs to the top, and set it to a single tab.
So far everything I've tried has led to not being able to create empty window failures at run time.
Thanks...
|
|
|
|
|
The company I work for uses a software built with COBOL. This software has no API and the only way to interact with it is through its GUI.
My question is: Is there anyway to integrate with such a software without any help from the vendor? For example, if this COBOL software has tow text boxes to enter 2 numbers for addition and gives the answer, is there a way to enter the two numbers programmatically? I am not even so much concerned about the answer it provides but just to automate data entry.
Please let me know if you need clarification.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
CodingYoshi wrote: ...is there a way to enter the two numbers programmatically? I am not even so much concerned about the answer it provides but just to automate data entry.
Can you use calls to FindWindow() and SendMessage() ? Not bullet-proof, but it might get you by.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
use spy++ tool to find, does cobol window provide you any windo handle
|
|
|
|
|
ThatsAlok does cobol window provide you any windo handle
How do I find out? If I can get a handle to the window, how would I go about finding the child controls to send keystrokes to? For example, how do I control sending name to a text box which accepts name of new employee or something similar.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Hi I am trying to create a server that would accept and receive message from multiple client. But i am receiving SOCKET_ERROR while my server seems to accept the multiple connection. Could anyone correct my code.
Here is the code I wrote..
CMysocket m_sListenSocket;
<pre>void CLocalDlg::OnAccept(void)
{
CMysocket *pSocket = new CMysocket;
if(m_sListenSocket.Accept(*pSocket))
MessageBox("Connection Accepted");
}
For receiving:
<pre>void CLocalDlg::OnReceive(void)
{
CMysocket *pSocket = new CMysocket;
char *pBuff = new char[1024];
int stlen = 1025;
int iRcvd;
iRcvd = pSocket->Receive(pBuff, stlen);
if(iRcvd ==SOCKET_ERROR)
MessageBox("Received socket error");
else
MessageBox("Message Received properly");
}
|
|
|
|
|
Did you preview your post? The <pre> tags are not working.
reddy07 wrote: iRcvd = pSocket->Receive(pBuff, stlen);
What is pSocket connected to?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Yes, tags are not working. I posted in hurry. I will take care next time when i post.
Thanks David!!! Yes, I realized every time OnReceive is invoked new pSocket is created. Then, how to initialize pSocket saying it is previously connected.
|
|
|
|