|
Sorry if you saw it 2nd time. But I need answer for this.
Can you give me some lines of code about:
-Get coordinates of the current character (in current line) in a rich edit control.
Ex:
CPoint pt;
pt=Get....(); //or something like that
Thanks.
Hung Son
A Vietnamese student
i-g.hypermart.net
dlhson2001@yahoo.com
|
|
|
|
|
Try GetCaretPos
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi.
I have a question about software design pertaining in particular to MFC and Windows programming in general. Windows programs rely heavily on messages. Objects sends and receive messages. Is it conventional to keep classes independent one of one another and/or is it conventional to integrate all classes and objects into on system of classes?
For example, I have a simple doc/view (SDI) program. There is a function in doc called Divide(). This function performs a divide of two integers. Now, let say I have a dialog box that requires the use of division. The difference is that the dialog box is not meant to perform division. It requires division for another purpose. In the case above, is it conventional to send a message back to main frame and then redirect the message to doc to perfect the division? Is it conventional to just create a new function for that dialog box?
If it is conventional to create a new function for the dialog box, then how about if the similarity is a structure, or a class?
Messages in Windows open up new doors for programmers allowing programmers to try out more tools.
Thanks,
Kuphryn
|
|
|
|
|
Others' opinion may vary, but mine is you should avoid accessing funtcionality thru Windows messages whenever possible. This introduces very strong dependencies on the overall architecture of the app, and makes it harder to eventually reuse some of the components you've written in other programs. In the very simple case you describe, unless your dialog box is strongly coupled to the whole application, it is better to pass it a "divider" object it can use for their dividing needs. Something like this:
class Divider
{
public:
virtual int divide(int a,int b)=0;
virtual ~Divider()=0{}
};
...
class YourDialogBox
{
public:
YourDialogBox(Divider& divider,...)
...
}; When launching the dialog, just pass a Divider -derived class that access the Doc and performs the required operation. This way you have a reusable dialog box with no particular dependencies on the rest of the app.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I perfer encapsulation too. Microsoft seems to have gone overly integrated with MFC.
Kuphryn
|
|
|
|
|
I'm stuck. Can anyone tell me how to edit a seperate file in C++. i have the filename and hex locations of what i want, i just dont know the commands.
Thanks,
Jordan
The world is what we make it. Lets plan well.
|
|
|
|
|
Depends on the file handling APIs you're using. For iostream s, after opening the file, use seekg and seekp to set the read and write cursor, respectively.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi does anyone know how to convert from the time_t type to a VARIANT DATE type? The problem is I can't use MFC and so COleDateTime can't be used.
Cheers
|
|
|
|
|
Look at Chris Sells CComDate
http://www.sellsbrothers.com/tools
|
|
|
|
|
Here's one way to do it:
Convert from time_t to FILETIME like this (Q167296):
void UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
// Note that LONGLONG is a 64-bit value
LONGLONG ll;
ll = Int32x32To64(t, 10000000) + 116444736000000000;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}
Then, convert from FILETIME to SYSTEMTIME by calling FileTimeToSystemTime().
Then, convert from SYSTEMTIME to VARIANT TIME by calling SystemTimeToVariantTime().
This is kind of like playing "Six Degrees of Kevin Bacon".
|
|
|
|
|
yah i know an installer will do that for me but i dont want this app to use an installer ... its static linked and has to be a single .exe file
i want to check if there is a start-menu shortcut and add one if not from within the exe
i know its prolly a no-brainer but i keep finding WSH references in msdn ... windows scripting host???
clues appreciated
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
|
Mike Nordell wrote:
IShellLink
Short and sweet
"When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it"
Nish on life [methinks]
|
|
|
|
|
|
Look at the following KB it shows how to do it
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q90493
|
|
|
|
|
yes,it can only read from a disk file
but an already running process?
|
|
|
|
|
GetModuleHandle(NULL) would give you the starting address of the process in the memory. The layout of the process is same in memory as on disk.
|
|
|
|
|
I am making a multi language application and therefore prefer to add static text strings to dialogs by using CStatic::Create rather than the resource editor. When I do this I allways get a bold typeface. I want to have the same font as I get by using the resource editor. How can I achieve this?
Haakon S.
|
|
|
|
|
first off ... multi-language doesnt mean u have to do things the hard way ... use the resource editor for your captions ... when you change languages you simply make a new resource dll and load it at run time ... thats the 'preferred' way afaik
to set the font for controls on a dialog use the SetFont(...) on the dialog box window ... to override specific controls u should trap the OnCtlColor(...) message and do the stuff you want there
hmmmm
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I am indeed making a new resource dll for other languages. But I put all my text strings in the string table and use LoadString() to show the strings in the CStatic controls. Hence the use of CStatic::Create(). Isn't that the right way? I know I can open the RC file as a text file and edit it, but that seems to be rather dodgy.
SetFont() takes a pointer to a new font. Is there an easy way to get a pointer to the standard font for static controls, like you do when you use SelectStockObject()?
Haakon S.
|
|
|
|
|
Found it....
1. Give each static control a separate ID
2. Allocate a control variable to each of them (m_Static1)
3. Use m_Static1.SetWindowText((LPCSTR)string);
Thanks for your help anyway.
Haakon S.
|
|
|
|
|
There is a good article in MSDN, titled:
"Instrumenting Windows NT Applications with Performance Monitor".
I have downloaded the samples and registered the counters.
However, the counters are not displayed in the monitor and an error code 1003 is displayed in the event viewer.
This is the error description:
"The object length of an object returned by Extensible Counter DLL "...D:\Work\PerfCounter1\ExtCountFinServer" for the "FinServer" service was not correct. The sum of the object lengths returned did not match the size of the buffer returned. Performance data returned by counter DLL will be not be returned in Perf Data Block. Count of objects returned is data DWORD 0. "
Could anyone, please, try this sample and check what is wrong?
How can i solve the problem?
Thanks,
Dudi
|
|
|
|
|
Hi.
I'm trying to create a function which would load text into a array.
Like
Text[100][100]
I'm making a kind of phonebook, char Text[will hold the name][will hold the phone number]
I'm trying to create a function which will scan a text file and place the name of a person and the phone number of a person in the Array.
Ex:
text.txt
name: blah 1 phone: numbers 1
name: blah 2 phone: numbers 2
name: blah 3 phone: numbers 3
name: blah 4 phone: numbers 4
The function should scan the file, and add the name to the first part of the array, and the phone number to the last part of the array..
How could I do this?
|
|
|
|
|
You'll have to read line by line and parse it manually!!!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
thanks.
But what functions could do this?
How might I do this?
Thanks
|
|
|
|