|
Ah, good stuff. That worked! Although, I'm not sure why you can't call the enableitems properly outside of the message handler. Oh well.
Thanks for your help
|
|
|
|
|
PhilipGa wrote:
I'm not sure why you can't call the enableitems properly outside of the message handler.
Because the handler resets them, I guess.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello. Looking for some help on using CPropTree from:
http://www.codeproject.com/treectrl/proptree.asp
I'm trying to use CPropTree in my project, as shown in the dlgsample, but I'm not actually sure how to set up the project to use it. Specifically, I'm trying to use do it like the example program that has :
#include <proptree.h> in stdafx.h, but it says it cannot find it. What changes to the project settings do I need to get this to work?
Any thoughts or help would be appreciated.
Thanks.
|
|
|
|
|
Hi,
This question is related to win32 user interface programming.
I need to use Single threaded runtime library and cannot use MFC. Thus I am using win32.
I have designed a dialog that should take three float values as input. How do write the code to do data exchange so that values entered by the user are available to me in some local variable after the user has clicked "OK" on the dialog after entering some values. I can do this in MFC and but do not know how to do this using win32. I could create file open dialog using GetOpenFileName but did not find any similar function for writing data exchange code.
Any help would be great as I am stuck and want to get this done asap.
Thanks in advance for your help.
Regards,
Abhijit
|
|
|
|
|
Use GetDlgItem to get the hwnd of the control
(hWnd is your dialog's hwnd, nIDC is your control's resource id)
HWND hWndCtrl;
::GetDlgItem(hWnd, nIDC, &hWndCtrl);
Use GetWindowText to then get the control's value:
TCHAR szT[64];
::GetWindowText(hWndCtrl, szT, _countof(szT));
|
|
|
|
|
Hi guys
Once again, please excuse me if this is way too simple... oh those newbies...
If I have to read a file with many lines of data, it would be useful for the user to be able to identify any particular entry that wants to be modified. Of course, the code that reads the data (or the manual) tells what it is, but for the user it would be easier if information could be added to the file that has the data with the program ignoring those bits of information. I'd appreciate any simple solution to this.
Thanks a million!
|
|
|
|
|
Do what all languages do - define a character sequence to indicate a comment. For example, in C++, it's // or /* ... */. Use a sequence that makes sense to your users, if they use VB, for example, use '. Then the trick is that any string that is valid and starts with ' needs to start with a known sequence to escape that character ( such as '' ).
The other way to do it is to use XML, and then HTML comments are valid.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
uh... either I didn't make myself clear or I didn't understand your response. Of course I know that INSIDE THE CODE I can use // or /*...*/. The question is how do I comment in a file to be read by the program, making the program ignore the comment... just the same as in the code but while reading the file. Say I have the following code:
int main()<br />
{<br />
int id;<br />
double Stuff;<br />
ifstream GetData;<br />
GetData.open("D:\\SSL\\Code\\Testing_Rutines\\FileComms\\comms.dat");<br />
if (! GetData.is_open())<br />
{ cout << "Error opening data file" << endl; exit (1); }<br />
else cout << "Commented file opened" << endl;<br />
<br />
while(!GetData.eof())<br />
{<br />
GetData >> id >> Stuff;<br />
cout << id << Stuff;<br />
}<br />
GetData.close();<br />
<br />
return 0;<br />
}<br />
And the data file has (with comments):
// first
1 2.3
// second
2 3.5
// third
3 9.8
where the program needs to ignore "// first" , "// second" and "// third".
If your response is that I need to "define a character sequence to indicate a comment" I have absolutely no idea how to do it. Both // and /*...*/ are already defined in C++ as comments inside the code, I don't have to define anything.
Thank you!
|
|
|
|
|
I'm saying that you read the data a line at a time, and check each line for the comment delimiter, and if it is there, ignore it for processing.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
That sounds as if you were recommending to read both the data and the comment and then just ignore/destroy the comment read. If so, that is something I don't want to do. I want to read the data only and if a comment is found ignore it, do not read it.
Thanks!
|
|
|
|
|
Then you're screwed. You can't know that a comment exists without reading it from disc and examining it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
As Christian is saying, if you're going to use a file where you're manually reading every line, then by definition, you'll have to manually parse the comment lines and ignore them. This is one argument for using XML as with XML you can specifically read data-only nodes and not read comment-nodes.
|
|
|
|
|
I allocate a CFileDialog for select and work on a file txt:
CFileDialog ldFile(TRUE, NULL, NULL, OFN_OVERWRITEPROMPT,"Text Files (*.txt)|*.txt||");
After... with data taken from this txt i have to do something with an access db that live in the same dir where the application has been executed:
m_db->Open(NULL, false, false, "ODBC;DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)};DSN='';DBQ=article.mdb");
The problem is that the app search article.mdb in the same dir where the user have been selected the txt file...
How can i do for read the db in the same dir of the app?
|
|
|
|
|
TCHAR buff[MAX_PATH];
GetModuleFileName(NULL, buff, MAX_PATH);
char drive[3];
char dir[MAX_PATH];
char fname[MAX_PATH];
char ext[MAX_PATH];
_splitpath(buff, drive, dir, fname, ext);
|
|
|
|
|
I am writing a C++ DLL that is accessed by a VB form.
The problem I have is that I need to use methods in the DLL that deal with an object that I cannot pass back to the VB form.
So far the only way I have found to get around this problem is by wrapping the C++ class and creating an instance of it, then passing the pointer to that instance back to VB. Whenever VB calls a method it includes the integer (object pointer) in order for the C++ code to reference the instance of the class.
However, I don't want to have to create a wrapper like this. Is there any way for me to make the methods and the objects created in the DLL static so that they can be accessed through multiple method calls from VB without passing this object pointer?
|
|
|
|
|
CimTaurus wrote:
Is there any way for me to make the methods and the objects created in the DLL static so that they can be accessed through multiple method calls from VB without passing this object pointer?
it's tough to say, without knowing how these object[s] are used by your system.
if the VB code only ever uses a single object instance in the C++ code, you could just make the object global in the DLL, and have all method calls use that global object.
DLL
-------------------
global exported
objects: functions:
<-- FooMethod1(...)
CFoo <-- FooMethod2(...)
<-- FooMethod3(...)
<-- BarMethod1(...)
CBar <-- BarMethod2(...)
<-- BarMethod3(...)
-------------------
if you want to operate on multiple instances of the CFoo and CBar objects, though, you'll need a way to distinguish them externally, and in that case, the object pointer is as good as any other method.
what is it about the way you're doing it that you don't like?
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
A project I'm working on has me updating some app generated e-mail code (that used Simple MAPI) so that it can send image attachments that show up inline as part of an html message instead of simply as attachments. I used CDO for this, which worked great once I could finally figure out how it all worked (worst part is most of the MSDN samples were usually missing one key component to get it to work ... grr). I'm almost done, except for one little problem. What I want to do is open the generated e-mail up with the default e-mail program, to allow the user to change the message as they want and put in recipients. But, using the IMessage's Send function, the call will fail unless there is a recipient specified ... in other words, it will only send the message silently, without user interaction.
With simple MAPI, I can simply call SendMail with the MAPI_LOGON_UI|MAPI_DIALOG flags, and it opens up the e-mail in the e-mail client. This works great, and is what the old code used to do. Too bad I can't use this function with the IMessage message.
From what I can see from sample source and other documentation, with pretty much any other language supported by microsoft, the Send function I'm calling has a ShowDialog parameter that allows you to pop-up the dialog like I want it to (I'm so sick of seeing VB examples like this I could just puke). Unfortunately, this function is not available with C++, it only has the one version that takes no parameters.
One line of thought I had was to save the email out as a temporary file, then send open it with a shell command .. but that won't work quite right either, the generated e-mail can be saved as a .eml file, which opens up in Outlook Express ... not the default e-mail program, and even that doesn't quite work the way I intend either.
I've been searching through MSDN and the web for over a day now, and because the functionality is there for other languages, I know there has to be a setting or field I can set to allow this ... but I can't find anything. Anyone go through something similar, or have some other place I can look?
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
how can I load a bitmap from file and display it inside (let's say) a static control?
thank you
|
|
|
|
|
|
A. You can go to Resource Editor and add bitmap to your resources. Add static picture control to your dialog, make it type bitmap and set the ID of the bitmap you loaded as resource for this control. This is done before you compile.
B. Use an imaging library. I like FreeImage. There are others: CxImage, DevIL etc etc. So loading a bitmap depends on the library you use. There's some code
http://freeimage.sourceforge.net/developers.html#faq. Once you load the image, override the class for the user control you're using and implement OnPaint() function to draw the bitmap you loaded.
This should get you started.
|
|
|
|
|
i want to count print outs printed by printer is any way to do this plz suggest me.
i am making cyber cafe managing software i need to count print out in my program
|
|
|
|
|
How can I programatically find out if MS Excel is installed on a PC and where it resides?
Thanx!!
~Nitron.
ññòòïðïðB A start
|
|
|
|
|
I would reccomend going through the Registry. Read HKEY_CLASSES_ROOT\.xls and see what the associated program name is. If this key doesn't exist you know right away that Excel is probably not installed. Next take the value read from the default value (usually something like "Excel.Sheet.8") and look for it in the registry with the command path appended:
HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\Open\command
The default value of that key will tell you the location of Excel. You will have to parse it up a bit though. Hope that helps.
|
|
|
|
|
HKLM/Software/Microsoft/Office/<Version>/Common/FilesPaths
|
|
|
|
|
Thx!!
~Nitron.
ññòòïðïðB A start
|
|
|
|