|
If I understand it correctly, you don't want it to run the block of code if status = "sent" or "cancelled by user". Try doing the following if statement:
if (!((str_Status == "Sent") || (str_Status == "Cancelled by User")))
If it's equal to "Sent", then it returns false
If it's equal to "Cancelled by User", then it returns false
If it's equal to "Anything else", then it returns true.
Hope this helps,
Tim
|
|
|
|
|
Step through the != operator code (F11 in the debugger) to see the logic flow. First it tests str_status != "Sent" . Since str_status is, in fact, not equal to "Sent" , the left side of the || is true. Since || short-circuits in C, the || evaluation immediately stops and returns true . Since the if test is true , the block of code following the if runs.
What you want is
if ( str_Status != "Sent" <font color=red>&&</font> str_Status != "Cancelled by User") && not ||
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
In an or test || if the first condition is true the second conditon is not even tested for, thus in your
if ((str_Status != "Sent") || (str_Status != "Cancelled by User"))
(str_Status != "Sent") is true so the if statement is executed. Just use (str_Status != "Cancelled by User") as the sole condition.
|
|
|
|
|
Hi,
Could anyone tell me how could I implement opening a folder as seen on some of the CD setup, such as Browse CD (MFC).
.
Thank you,
Mariusz
|
|
|
|
|
Do you mean, how to make a window automatically pop up when inserting a CD disk into the CD-drive, then
1.Add a file in your CD's root folder named: autorun.inf
2.Set it's content to
[AutoRun]
open=folderonyourCD/yourexetoberun.exe
icon=folderonyourCD/yourexetoberun.exe,3
Peter Molnar
|
|
|
|
|
In case that some of the buttons' captions (or other resources)of a dialog application have been changed - is it possible at runtime to set all the resources to their original names/values? I tried with AfxSetResourceHandle(), but nothing happened. Any suggestions how to do this? Thanks.
|
|
|
|
|
I assume you used a dialog template to create your dialog ?
Now, mostly all (if not all) controls you place on this template are NOT resources, but control windows. The button is not a resource; it is a window with "Button" class and a title it displays on it as it's caption. If you use an icon or a bitmapped button, then those resources are bound to the button: a window with a bound resource that is drawn to it.
So, once more: the dialog template is a resource, but the controls placed there are not. The template just specifies what controls are placed and where. The Framework will worry about creating these controls and placing them. Consider the template like a drawing plan.
If the captions of buttons have changed, it is possible to change them back by using GetDlgItem and specifying the ID as parameter. If you convert the return value to CButton* , you can use the 'SetWindowText' method of the class to set the button's caption.
Hope this helps. If it doesn't, I suggest you dig up the infamous 'Programming Windows' book by Charles Petzold. This should help you get started by first introducing you to the concept of resources: what and where they are and how they are used in a Windows environment.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
OK, thanks! But I was trying to avoid using GetDlgItem and SetWindowText functions. What I was asking was is it possible to load the default values (caption, size and so on)as they are defined in the *.rc file? Let's say the captions of some button or static controls have been changed (using 'SetWindowText'). Is it possible at runtime to restore the original values as they are defined in the *.rc-file? I mean to load them directly from this file? I can't get Petzold's book and that's why I'm asking here. By the way, is it available somewhere on the net as eBook?
Greetings -J.
|
|
|
|
|
How to get CMenu* for the menu loaded with the document (IDR_xxxTYPE resource) in a MDI app?
|
|
|
|
|
Call AfxGetMainWnd()->GetMenu();
|
|
|
|
|
Rejeesh.T.S wrote:
Call AfxGetMainWnd()->GetMenu();
thanks for your answer, but:
with this you get the default menu. This menu is shown when no document is open. (IDR_MAINFRAME)
I want to get the shared menu loaded by the framework if a document is loaded (IDR_xxxTYPE)
|
|
|
|
|
You need to access it through the relevant CDocTemplate object registered in InitInstance.
If your doing this in a document object, you can use GetDocTemplate()->m_hMenuShared. If you need to access it from elsewhere, you need to use the undocument class CDocManager through the CWinApp:m_pDocMan(ager) pointer. Use the GetFirstDcoTemplatePosition() and GetNExtDocTemplate() iterator functions.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hello,
I'm curious about what date type is a HANDLE? Is it an int pointer? Thanks.
|
|
|
|
|
Not exactly a pointer,it just a handle,you can take some operation on it or with it
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Hello ,
As I know from Inside Win2k, when a process creates or opens an object(object is almost everything in Windows ) by name, it receives a handle that represents its access to the object. This is
like a secure pointer taken from OS.
**Object is symbolic link, process, thread, job, section, event, semaphore and ...
|
|
|
|
|
I spoke wrong. I mean literally what is it in terms of size. For example, DWORD is really a 32-bit unsigned integer. I'm trying to read some data that contains HANDLE type in a structure. I'm reading it over in a UNIX app. I have no use for the HANDLE, but my sizing will be wrong if I ignore it.
|
|
|
|
|
me think a HANDLE is the same size as a pointer; so 32 bits.
look into winnt.h
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
How about sizeof(HANDLE) ?
|
|
|
|
|
I think this will give you clear answer !
typedef void *PVOID;
....
#ifdef STRICT
typedef void *HANDLE;
#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
#else
typedef PVOID HANDLE;
#define DECLARE_HANDLE(name) typedef HANDLE name
#endif
typedef HANDLE *PHANDLE;
** This is taken from WinNT.h
|
|
|
|
|
HANDLE is unsigned long (DWORD). It is like a pointer because it is unique, but it is hashed to some pointed in memory. Windows manages the memory and this can be shifted and moved around to prevent memory fragmentation, but the HANDLE remains the same.
J.
----------------------------
|
|
|
|
|
I have tryed to make a little program, it should load its String from a XML file created like this.
<br />
<DATABASE version="1"><br />
<ACCOUNT id="98">FreeGeG</ACCOUNT><br />
</DATABASE><br />
how do i load that file into my Program, so i can use them at Strings?
Thanks
|
|
|
|
|
You could use Xerces, XML4C or a class from here.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
At First Objects[^] you can get a fine little XML parser for free. Only the extended version consts money.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I have an application in C++ (VC6.0 SP5 Win 2K) which runs fine in Debug and crashes in Release.
In the output debug window, when running the app in the IDE, I get the following message "Invalid Cache depth".
Anybody has a clue?
Thanks to whoever has!
|
|
|
|
|
I don't know about the error, but you might want to take a look at XCrashReport - Exception Handling and Crash Reporting by Hans Dietrich. It covers debugging release mode applications.
|
|
|
|