|
Have you put a using System::Windows::Forms in your stdafx.h file?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have a CListControl. I can already tell when a user clicks on an item in the list control (I then update an edit control with the currently selected text from the list control), but I want to be able to capture the selection changes as a user scrolls up and down with the arrow keys. (As the selection changes, I want to update an edit control with the same text that is currently high-lighted in the list control).
E pluribus chumpus, unum chump patria.
|
|
|
|
|
I think you are using the CListControl_click event to update the control's right.
I that case if you want to be able to change capture with the keyboard key press I think is better to use the onValueChange event (or something like that) that way if the user click again on the same value you don't update it just stays the same. LESS process consuming.
Kamui
|
|
|
|
|
Handle LVN_ITEMCHANGED and look at the old/new state flags. When the old state does not contain the LVIS_SELECTED bit, and the new state does, that item is now selected.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Hello!
I'm having a problem writing string objects to a file. I just learned file I/O and am not quite sure what the problem is. I am using a string object
(basic_string<char *> ) and it doesn't seem to like what I am doing. here is some sample code:
#include <fstream>
using namespace std;
#include <cstring>
ofstream myFile("file.txt");
int main()
{
string myBuffer("Some text");
myFile.write(myBuffer, myBuffer.size());
myFile.close();
return 0;
}
this does not like my string going into the file. I have also tried the extraction operation << with it, but it says it is not defined... I thought the function fstream & operator<<(string & someString) was defined in the string class... any help?
|
|
|
|
|
|
well, that would work using the CString class, but I'm trying to use the typedef'd string class from basic_string<char *>
I believe it is in the <string> header file...
I've never used the CString class(that I know of, and I'm trying to stick to using the one I'm used to..
It doesn't work using
#include <string>
basic_string<char *> myString
myOutputFile << myString;
|
|
|
|
|
myFile.write(myBuffer, myBuffer.size()); That won't do what you want. You want to write the contents of the string, not the object itself, so do:
myFile.write(myBuffer.c_str(), myBuffer.size());
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
thanks very much! that's what I was looking for
|
|
|
|
|
Hello friends Is it possible to open a image JPEG into CDialog????, because, All the peolple make a example to open as backgound, or other classes but NEVER open in a CDialog, why??, I don't know how is it?, I review the library GDI.
Is it possible to open in a CStatic??? or a CEdit???, or a CList???.
Please If somebody know How I can to make it, help me with that.
The Best Regards
NiponWare
|
|
|
|
|
You can load a jpg with GDI+, and paint it on whatever you want. You can handle WM_ERASEBACKGROUND to do this.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hello, do you have any examples about that??.
Regards
NiponWare
|
|
|
|
|
The FAQ does.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
|
Thanks friends, It's genial, that's great!!!.
The best Regards
NiponWare
|
|
|
|
|
I have made a program using Microsoft Visual C++ 6.0 using MFC app, and ive decided to "enhance" it...
Its basically a "blog" or "journal" in a way... I was wondering whats the easiest way if someone clicks on "save" (i have it set to save to folder as (date).txt and inside is the entry... But i was thinking about using a Tree for the folder to easily access all journal entries... What would be the easiest way to access all the journal entries added using the same program?
Possibilities;
1) OnSave, saves file to folder and somehow automatically save title to a ComboBox that'll allow you to click on it and allow entry to be viewed...
2) Tree, having tree set to that folder only allowing user to click on file wanted and having it open entry like combobox idea...
Im queued... I dont know how to use the Tree control, all tutorials ive found are based around C:\\ (a tree for full harddrive with 2 classes and millions of files)... Is there a way to make it so that a user can view past save's in a combo box and being allowed to click on date to view entry?
/* Just a Human Trying to Live in a Computers World. */
|
|
|
|
|
Mentally separate the files (data) from your user interface considerations for a moment.
Suppose you had something like a calendar control instead, that had a different representation for the days that HAD journal entries. The user could go back and forth a month or year at a time. They could double-click on the day for the journal they wanted to see. Hovering over a date would show a tooltip with the subject of that journal. A sort of 'report view' in this control would perhaps have the date along the left column and the subject in the right column. Anyway, just a different way to think about selecting an entry than a 'tree view'.
If your data representation is separate from your user interface, you can experiment with different 'views' of your data without constantly rewriting your program.
|
|
|
|
|
Thanks... Never thought of it that way...
A friend of mine made a basic calander program for his class that would show white for non-entered data, and colored for entered data and when clicked it would open another CDialog with the data entry...
Similar to the idea of the ComboBox but i just started using MFC, and im just experimenting and ive caught onto it pretty easily... Thanks for your input ill give it a try...
Do you know any tutorials or open sources to easy access to files without trees that i could review?
/* Just a Human Trying to Live in a Computers World. */
|
|
|
|
|
There are some 'file helper classes' here on CodePRoject that fill CStringArray with all the files in a specified folder or set of folders. You might want to use them to find your journal entry files. The MFC class CFileFind performs local file searches. Also the FindFirstFile function searches a directory for a file or subdirectory whose name matches the specified name.
|
|
|
|
|
Hello, i hope that this question is not misplaced in this part of the Forum, but if it is then i apologies.
I have a Global Hook callback procedure that is executed by the system each time an application tries to install a hook. This procedure (DebugProc)takes the following standard parameters:
int nCode,WPARAM wParam,LPARAM lParam
where WPARAM contains the type hook that is trying to be installed.
LPARAM is a pointer to a DEBUGHOOKINFO structure (defined natively and not customely). Is it possible with those informations to get the process id that has initiated the installation of the hook?
|
|
|
|
|
See CreateToolhelp32Snapshot and specifically the TH32CS_SNAPTHREAD.
In the THREADENTRY32 you can correlate th32ThreadID (which you have) with th32OwnerProcessID (which you want to know). Assuming the tool help functions can work within the debug hook procedure.
|
|
|
|
|
Rabih Sarieddine wrote:
Is it possible with those informations to get the process id that has initiated the installation of the hook?
Absolutely. The hook function is called from the context of the process and thread that performed the operation that caused the hook event to be triggered. This means that GetCurrentThreadID() and GetCurrentProcessID() will give you the thread and process IDs of the thread/process that caused the event.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thank you for your quick answer. Unfortunately, the GetCurrentProcessId returns the process id of the application that installed the Debug Hook. The Debug Proc Callback procedure is triggered whenever an application (lets say for example a keylogger) tries to install a hook (like Keyboard Hook).
If i call GetCurrentProcessId() from the Debug Proc Callback, i get the process id of the my application (the one that installed the Debug Hook). What i need is to get the process id of the keylogger.
|
|
|
|
|
Oops Sorry about that! Oh well. You learn something new every day
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi
Would anyone have the source for the project at this address
http://www.codeproject.com/miscctrl/axtraycontrol.asp
Sounds similar to something I have been trying to do with PCR Plates. It doesn't seem to be posted any longer. I click on the download link and get page can't be found.
Thank you
Gregg
|
|
|
|