|
Give the customer release DLLs or EXEs (whatever they are) with Debug Strings at the places where you might think crash has happened and then check the outputs.
|
|
|
|
|
int errcode = GetLastError() ;
GflPower
|
|
|
|
|
Hello.
Read this[^]
article.
It has saved me more than once. If you do as the article says, you can pinpoint the exact code line in the source-code, where the error occurred! (In a release build).
Kakan
|
|
|
|
|
I hope this question makes sense...
If I have a number of controls in a CView derived class, how can I get that view to pass on any messages from the controls to the view's parent window?
|
|
|
|
|
SendMessage
or
PostMessage
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Hi,
I have this code for connecting to SQL Server:
CString sql;
CDatabase m_database ;
sql.Format("DRIVER=SQL Server;SERVER=myserver;DATABASE=test;UID=administrator; PWD=admin;Trusted_Connection=No");
m_database.SetLoginTimeout(10);
m_database.SetQueryTimeout(10);
TRY{
m_database.OpenEx (sql,CDatabase::noOdbcDialog );
}
CATCH(CDBException, e){
m_database.Close();
MessageBox("Connection failed");
}
END_CATCH
I am connecting to a remote sql server. This code works fine if I'm connected in the network and i was able to catch the Exception, however, when I disconnect the host pc from network, an unknown exception was thrown. "Unknown software exception (0x0000409)..." . Is there any way to catch this exception ? It also happen when I mispelled the server name.
Mar Solero Jr.
|
|
|
|
|
I have an CSpinButtonCtrl autobuddied with an EditBox. How can I get the CSpinButtonCtrl to inc/dec in 2's as I only want even numbers to appear in the EditBox and by default the CSpinButtonCtrl inc/decs in 1's.
Follows is a stripped down version of my implementation
In the .h file I declare
class C_VIEW : public CDialog<br />
{<br />
public:<br />
C_VIEW(CWnd* pParent = NULL);
CSpinButtonCtrl m_spinner;<br />
};
In the .cpp file I implement
void C_VIEW::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
DDX_Control(pDX, IDC_SPINNER, m_spinner);<br />
}
In the initialisation routine I set the min/max range
BOOL C_VIEW::OnInitDialog() <br />
{<br />
CDialog::OnInitDialog();<br />
m_spinner.SetRange(0, 100);<br />
}
the value is saved when the dialog box is closed.
void C_VIEW::OnOK()
{<br />
save_all_values();<br />
CDialog::OnOK();<br />
}
I thought of rounding the value as it is saved, but that is not elegant and would misguide a user who had selected an odd value.
cgb143
|
|
|
|
|
Do not use the UDS_SETBUDDYINT style, and instead handle the WM_VSCROLL message that the spin control sends to it's parent window. Get the position of the spin control, double it, and set the edit control's text accordingly. You also have to remember to set the spin controls position when the text in the edit control is changed to make sure the edit control and spin control stay in synch.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Get the position of the spin control, double it, and set the edit control's text accordingly.
He only wanted EVEN numbers.
I would get value, see if it is odd, and add one.
if( X & 1 ) x++;
No shirt, no shoes, no brains, no service.
|
|
|
|
|
Use SetAccel()
UDACCEL accel;
accel.nSec=0;
accel.nInc=2; //take note, this is the one that does the trick.
SetAccel(1, &accel);
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Many thanks.
This works well (as you knew it would)
|
|
|
|
|
cgb143 wrote: Many thanks.
Nice to know that.
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Totally cool!
I had only ever used accelerators to 'speed up' lengthy spins. Never occured to me to use one to force even numbers.
Of course, if an odd one ever gets int here (like they enter number directly in an edit field) ... Hmmmmmmm
No shirt, no shoes, no brains, no service.
|
|
|
|
|
No it really works.
I tried starting with a 1 and it steps to 2,4,6 etc (or 0) automatically.
cgb143
|
|
|
|
|
That is neat, even (no pun intended) better
No shirt, no shoes, no brains, no service.
|
|
|
|
|
Hi-
I am new to VC++ and need help to create a UI that implements tree view to organize a .txt file (similar to windows explorer, except not dealing with folders, but rather with the internal text of the .txt file), and then be able to display the selected portion of the .txt file into the right pane of the the UI...
i.e. in the .txt file there is a date and time, log-in information, etc.--- so i want to be able to populate a tree view list on the left pane of the that has all the information seperated and organized to where i would click on a node specified (DATE/TIME) and some sort of event handler could recognize when the (DATE/TIME) node was clicked and generate that portion of the text document into the right pane of the UI.
IF anyone could assist me in getting started that would be greatly appreciated. Like i said i am very new to VC++ and for that matter C++, but if anyone could guide me and point me in the direction i need to go, that would be greatly appreciated.
I am assuming that i need to parse (which i need help to do as well) the text file first and then generate a TreeView based on the the text file. I can generate the basic UI in VS 2003 using windows form editor, however when i create a tree view in the left portion of the UI, i can't do anything with the nodes in the tree view once i create them. PLEASE HELP!
|
|
|
|
|
start with MFC and look at some of the examples on how to create a treeview.
|
|
|
|
|
Thank you i am doing that now!
Can u also guide me as to how i may want to parse the .txt file?
Thanks!
|
|
|
|
|
MFC has a file class called CFile
use that to read the file
read the text into a char buffer (make sure it's sufficiently big or read a character at a time)
use strtok to "parse" the lines
I can't be much more help than that without knowing the format of the file. However, given your first post, I am assuming there's a heirarchical nature to the text file. So, obviously each time you "descend" the heirarchy you add a child node to the treeview. And each time you ascend the heirarchy you find the current node's parent so that any new children are added to it.
If it were in XML then you could use MSXML to read and parse it.
|
|
|
|
|
Lenny P wrote: Can u also guide me as to how i may want to parse the .txt file?
Have a look at the CStdioFile class, or CreateFile() and ReadFile() .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Please help me with the proper terms here. I want to run an application on startup and have it run hidden. I don't care if it shows in the task list but I don't want it visible anywhere on the desktop.
What should I be searching on? I have a console app that does what I want it to do now but I can convert it to something like a service if that's what it needs to be.
Thanks!
|
|
|
|
|
you can make it a windows application instead of a console application.
|
|
|
|
|
In other words, if you make it a windows application, but don't create a window, it will be really hidden! The task name will show up in task bar, but there will be no visible widnow.
Now, the soapbox. The Kodak EasyShare shoftware does this crap. And, every time I go to shutdown my wife's Windows XP box, I get a warning about "user has 1 program running you could lose data .. blah blah blah..." and this is very annoying, because an INEXPERIENCED user would be scrathing their head trying to figure out where is the G_____N app that is running??
So, I would also encourage you to diligently process any notifications or other events (difficult if no window..) that he system would send you regarding shutting down or logging off.
No shirt, no shoes, no brains, no service.
|
|
|
|
|
Say your application name is MyProg.Exe, and is located in C:\Program Files\My Company, then add an entry for your program in the following registry key, as follows.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\"C:\Program Files\My Company\MyProg.exe"
Windows will run any program inside this key automatically, on startup. I dont know what kind of an app it is. If it has nothing to do with the user, then it would be better to make it as a service.
Regards,
Rajesh R. Subramanian.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
Hi All,
I am a novice and would appreciate any help you guys can give me here. I want to write a code which will tell me with which window the user is currently interacting. The code I am using is
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
int test;
HWND hwnd;
MSG Msg;
TCHAR szBuf[80];
int nMaxCount;
DWORD d;
int nCmdShow;
while(1)
{
hwnd=GetActiveWindow();
if(hwnd == NULL)
{
MessageBox(NULL, "No window is currently active!","Error!" MB_ICONEXCLAMATION | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
test=GetWindowText(hwnd,szBuf,80);
}
}
Here GetActiveWindow returns NULL .If I use GetForegroundWindow, I get the handle of the IDE i.e VC++ and so on. How do I write a code which will tell me which is the window the user is currently interacting with?. My ultimate aim is to figure out which is the currently active window and grab images from the window. So in this case would I need to run an exe from my main code which will give me the handle to the active window? Any better idea how do I do it? Waiting for replies from the experts out there!!
-confused newbie
|
|
|
|