|
A simple question: I'm creating an edit control with the usual CreateWindow function. How can I change the background and text color of this control? Thanks.
|
|
|
|
|
See this message :WM_CTLCOLOREDIT .
|
|
|
|
|
|
You're welcome.
|
|
|
|
|
why do i get
Run time error!
c:/.../.../pc.exe
Abnormal program termination.
while i'm running my application(MFC) in VISTA.
whereas it is working fine in XP.
Can any one please help mi in this regard.
thanks in advance...
Saavana...
|
|
|
|
|
Can you more explain about your program,did you use of debugger?
|
|
|
|
|
HI
Iam trying to put dockable toolbar on a dialog.I wrote the following code but it is fixed on the top but it is not dockable.Is there any changes plz tell me.
toolbar.CreateEx(this);
toolbar.LoadToolBar(IDR_TOOLBAR1);
toolbar.SetBarStyle(CBRS_ALIGN_TOP|CBRS_TOOLTIPS| CBRS_GRIPPER|CBRS_FLOAT_MULTI );
RepositionBars(AFX_IDW_CONTROLBAR_FIRST , AFX_IDW_CONTROLBAR_LAST, 0);
thanque
#sanroop#
|
|
|
|
|
|
Hello All,
i'am using printing option in my project , i'am giving data to the printer from my database(MS Access).
if my database having 10 set of data , but i need to print the 10th set data, so i used the while loop to get the last set of data.
but my printer stores the all 10 set of data in it's temporary memory ,it print the 10th set of data with the last 9th set of data.
so can u please tell how to clean printer memory?
Panthal
|
|
|
|
|
Are you sending the ninth record to the printer?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Then how is it being printed?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Let's say there is a file which has content like the below for example:
[Configuration.x86]
Memory = FF1040A0
IO = 2FF
Flag = 12,15 With iostream library,
1. how to locate and modify the value in IO section from "2FF " to "A2FF "?
2. how to delete the token "12, " in Flag section?
Thanks.
Maxwell Chen
|
|
|
|
|
Why do you want to use iostream when GetPrivateProfileString will make your task so much easier?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
CPallini wrote: Why do you want to use iostream when GetPrivateProfileString will make your task so much easier?
My target is oem*.inf in C:\Windows\inf. GetPrivateProfileString is for .ini files. It looks like also working for .inf files. I will try it on Monday. Thanks!
By the way if the target is gereral article content, what would be a better way (efficient) to modify and to delete substrings in the file?
For example (below paragraph), to delete "will ", and locate the next word "make " and append an "s" to form "makes ".
Why do you want to use iostream when GetPrivateProfileString will make your task so much easier?
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: My target is oem*.inf in C:\Windows\inf. GetPrivateProfileString is for .ini files. It looks like also working for .inf files.
Indeed it works whatever file extension is (only the file format is important, it must be *.ini compliant)
Maxwell Chen wrote: Thanks!
You're welcome.
Maxwell Chen wrote: By the way if the target is gereral article content, what would be a better way (efficient) to modify and to delete substrings in the file?
For example (below paragraph), to delete "will", and locate the next word "make" and append an "s" to form "makes".
Why do you want to use iostream when GetPrivateProfileString will make your task so much easier?
You have to:
(1) load the file in a buffer.
(2) make all you search/replace/add operations into the buffer.
(3) write the buffer to the initial file.
Point (2) maybe accomplished with hand-crafted search operations, using a string class (for instance std::string or CString ) or a powerful tool like a Regular Expression parser (see for instance http://www.ultrapico.com/Expresso.htm[^]).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
hi
i have a application for mobie application.
all v know when v right click the icon button there will be some option like exit,about , start ,stop ..
i used the code
void CControlContextDlg::OnContextMenu(CWnd*
/*pWnd*/, CPoint point)
{
// TODO: Add your message handler code here
// Load the desired menu
CMenu mnuPopupSubmit;
mnuPopupSubmit.LoadMenu(IDR_SUBMIT);
// Get a pointer to the button
CButton *pButton;
pButton = reinterpret_cast<CButton
*>(GetDlgItem(IDC_SUBMIT_BTN));
// Find the rectangle around the button
CRect rectSubmitButton;
pButton->GetWindowRect(&rectSubmitButton);
// Get a pointer to the first item of the menu
CMenu *mnuPopupMenu =
mnuPopupSubmit.GetSubMenu(0);
ASSERT(mnuPopupMenu);
// Find out if the user right-clicked the button
// because we are interested only in the button
if( rectSubmitButton.PtInRect(point) ) // Since
the user right-clicked the button, display the context menu
mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN |
TPM_RIGHTBUTTON, point.x, point.y, this);
}
...
in this when v right click the button popup menu appears but i want when i right click the tray icon popup menu should appears .
help me
advanced thanks
K.Guru moorthy
k.guru moorthy
|
|
|
|
|
guru moorthy.k wrote: i want when i right click the tray icon popup menu should appears
When you add your tray icon with Shell_NotifyIcon(), specify
a window handle and a callback message along with the NIF_MESSAGE
flag.
When the window receives that message, check the LPARAM
for WM_CONTEXTMENU. When you receive that message use
TrackPopupMenu to show the menu.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I try to convert my old MFC application that use multibye encoding to UNICODE by using TCHAR programming method.
but there is a code the create a file using ofstream that I dont know how to convert to TCHAR-programming.
I also tried std::wofstream
<br />
<br />
wofstream outFile(_T("outfile.txt"));<br />
outFile<<_T("Test international character : ???????,??????")<<_T("\n");<br />
outFile.close();<br />
<br />
But it didn't work , only the english portion is written to the output file (and the file are still ASCII as open in notepad).
Can someone suggest me how to fix the problem ?
Edit : those ?????? are suppose to be thai & arabic text
|
|
|
|
|
I have a program using another dll library of mine.There are some codes like this:
//caller
std::string* paths = NULL;
int count = find_path_strings(&paths);
if(count>0)
delete [] paths;//error occurs here,the error message tells me that the heap memory is damaged
//in the library
int find_path_strings(std::string** paths)
{
char** paths_array = NULL;
int count = find_paths(&paths_array);//this function will alloc the paths_array
//also will initilize it and return the array element count
*paths = new std::string[count];
for(int i=0;i < count;++i){
(*paths)[i] = paths_array[i];
free(paths_array[i];
}
if(paths_array)
free(paths_array);
return count;
}
but if I copy the source codes in my library to the main program(caller),it will works well.(I using the library with a .dll and a .lib file.)
Someone would tell me why and how to resolve such strange problem?
Thanks.
GOOD LUCK.
|
|
|
|
|
Make sure both the DLL and the EXE projects are using the same
CRT library.
Project properties/C++/Code Generation/Runtime Library
If you'll be passing allocations back and forth across the DLL/EXE
boundary, they both need to use the DLL version of the CRT.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes,there is one project using MFC in a static library and the other using MFC in shared DLLL.
I change their setting as the same,every thing works well now.Thank you.
Best wishes.
|
|
|
|
|
kcynic wrote: Best wishes
To you too! Happy Holidays!
Cheers
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
errors occur now!
The same library,I create a new user project(console,MFC surported).No matter I change their setting as Use MFC in a static library or Use MFC in a shared DLL,the user program will crash at the same position: delete
But the older user project(MFC dialog based) will work well no matter its MFC using setting is the same like the library or not.
How should I fix the error,now?Thank you
|
|
|
|
|
The problem here is that your EXE and the DLL are using different heaps: you are trying to free memory in one heap that was allocated in another.
There are two common ways around this problem:
1. Add a “DLL_free” exported function to the DLL which you use in the client to free any memory allocated by the DLL. It simply calls “free” but because the code which does this is in the DLL and not the client the correct heap is used.
2. Build the EXE and the DLL using a DLL version of the CRT.
Option 1 is more flexible and professional.
Steve
|
|
|
|