|
Manni Singh wrote: tmpList.Detach();
I suspect this leaks the list that was already there, although it should be empty if there is one. It's at a minimum redundant.
Is destBitmap being created as a pointer ? I'm wondering if it's the leak ( from the calling code ) ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I think (not sure)I answered to like this for extract images of CImageList to a hbitmap you can use Search comment
|
|
|
|
|
I want to know when an edit box is clicked. I have found ON_EN_CHANGE is triggered only when I enter a character in the edit box. Is there any mesage triggered when I just click the edit box?
Thanks.
UPDATE: I found it. ON_EN_SETFOCUS triggers whn the edit box is clicked. Is there any drawback to using this?
-- modified at 13:03 Sunday 24th September, 2006
|
|
|
|
|
Oliver123 wrote: ON_EN_SETFOCUS
This wont get fired the next time you click on it. I mean when the focus is already there.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
moreover, WM_SETFOCUS will be sent if he navigates to his control using the Tab key...
|
|
|
|
|
Handle the WM_LBUTTONDOWN message.
Software Zen: delete this;
|
|
|
|
|
Is here any way to programmatically control(Add/Remove) the content listed in "Open With"->"Recommended Application". I believe this is recorded inside regisry, but where can I find it?
|
|
|
|
|
First you need the file extension say .xyz
HKEY_CLASSES_ROOT\.xyz
Look at the default value: xyz_auto_file
HKEY_CLASSES_ROOT\xyz_auto_file
Go into the sub-tree
HKEY_CLASSES_ROOT\xyz_auto_file\shell\open\command
I am quite sure that the file listed there is the one you are after.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hi all:
The following is the code snippet for print the Rich Edit control, but they to no avail. MSDN says EM_FORMATRANGE EM_DISPLAYBAND should be used, but they don't seem to work, I run out of idea.
<br />
PRINTDLG printDlg;<br />
ZeroMemory(&printDlg, sizeof(printDlg));<br />
printDlg.lStructSize = sizeof(printDlg);<br />
printDlg.Flags = PD_RETURNDC;<br />
<br />
if(!PrintDlg(&printDlg))<br />
{<br />
printf("Failure\n");<br />
}<br />
else<br />
{<br />
long lLineWidth = ::MulDiv(GetDeviceCaps(PHYSICALWIDTH),1440, GetDeviceCaps(LOGPIXELSX));<br />
FORMATRANGE fmtRange;<br />
RECT rect;<br />
RECT page;<br />
int last = 0;<br />
<br />
page.left = 0;<br />
page.top = 0;<br />
page.right = ::MulDiv(GetDeviceCaps(PHYSICALWIDTH), 1440, GetDeviceCaps(LOGPIXELSX));<br />
page.bottom = ::MulDiv(GetDeviceCaps(PHYSICALHEIGHT),1440, GetDeviceCaps(LOGPIXELSY));<br />
rect = page;<br />
<br />
fmtRange.hdc = MyDC.m_hDC;<br />
fmtRange.hdcTarget = MyDC.m_hAttribDC;<br />
fmtRange.rc = rect;<br />
fmtRange.rcPage = page;<br />
<br />
::SendMessage( m_REControl50W.m_hRE, EM_FORMATRANGE, TRUE, (LPARAM)&fmtRange); <br />
::SendMessage( m_REControl50W.m_hRE, EM_SETTARGETDEVICE, (WPARAM)printDlg.hDC, lLineWidth); <br />
::SendMessage( m_REControl50W.m_hRE, EM_DISPLAYBAND, (WPARAM) NULL, (LPARAM)&rect); <br />
<br />
|
|
|
|
|
About my project, user have to choose the folder for process some job.
I only have ever use Dialog for Save and Open file but never use the Dialog that use for select folder.
Please give me some recommend for this issue.
|
|
|
|
|
Derive a class from CFileDialog and implement OnFolderChange (i think) to suit your needs
|
|
|
|
|
try
SHBrowseForFolder()
Tanvon
the brain behind ...
I Blog here
|
|
|
|
|
|
If you dont want SHBrowseForFolder you can make your control with CTreeCtrl you can see examples on codeproject about it
|
|
|
|
|
Is there a way of building an ADO Recordset from some data?
I need to return a Recordset structure from a function but the data is not available trough a database so the ideea was to load the recordset and return it. I want to do this because for some user settings my application cannot read data from a database and building my own recordset beats going trough all the code and reading settings. I can simply change the method that does the querying.
Thanks
|
|
|
|
|
GDay everyone,
I need to save received characters into a file and display them to the screen later on in C programming.
How to write a character pointed into a file in function A, and display it in a function B?
Please help. Thanks in advance
eric
|
|
|
|
|
You can do that by many ways. You can use std::fstream , or the MFC's CFile or a direct "fopen" in C. Try searching these keys.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
u can use fopen method to open a file like this
<br />
FILE* pFile = fopen("file.txt", "a");<br />
where "file.txt" is the file name and "a" is the mode (Opens for writing at the end of the file (appending))
u can learn more if u look for this function in the MSDN help
use fprintf to write to the file
<br />
fprintf(pFile, "%s\n",szString);<br />
where szString is any Character string !!
note: dont forget to close the file
<br />
fclose(pFile);<br />
|
|
|
|
|
Thanks very much.
Here is the code I've just done, but I can't display the right format
Please give me a fix.
#include <stdio.h>
void display(){
FILE *file1;
int numbers[30];
int i,j;
file1 = fopen("try.txt", "r");
if(file1==NULL) {
printf("Error: can't open file.\n");
}
else {
printf("File opened successfully.\n");
i = 0 ;
while(!feof(file1)) {
fscanf(file1, "%s", numbers[i]);
i++;
}
printf("Number of character read: %d\n\n", i);
printf("The message are:\n");
for(j=0 ; j<i ; j++) {
printf("%s\n", &numbers[j]);
}
}
}
int main() {
FILE *file;
char *array = "eric";
file = fopen("try.txt", "w");
if(file==NULL) {
printf("An error has occurred.\n");
return 1;
}
fprintf(file, "%s\n", array);
display();
fclose(file);
return 0;
}
eric
|
|
|
|
|
eric_tran wrote:
while(!feof(file1)) {
fscanf(file1, "%s", numbers[i]);
i++;
}
%s reads strings, you need numbers (cause you've declared numbers to be a pointer to int), try fscanf(file1, "%d", &numbers[1]);
eric_tran wrote: for(j=0 ; j
printf("%s\n", &numbers[j]);
}
for(j = 0;j<i;j++)
printf("%d ", numbers[j]);
|
|
|
|
|
That's right.
I forgot to change it. I'd actually want to display string only.
Thanks
eric
|
|
|
|
|
easy way (not best)
#include <stdio.h>
int ReadAndStore(char lines[1024][1024])
{
int numberOfLinesRead = 0;
int i;
FILE* theFile = fopen("somefile", "r");
if(theFile==NULL)
return -1;
printf("Opened file for reading\n");
numberOfLinesRead = 0;
while(fgets(lines[numberOfLinesRead],1023,theFile)&&numberOfLinesRead<1024)
{
printf("%s", lines[numberOfLinesRead]);
numberOfLinesRead++;
}
fclose(theFile);
return numberOfLinesRead;
}
int main(int argc, char *argv[])
{
printf("scream if this is to big\n");
char fileContents[1024][1024];
printf("i didn't scream\n");
int i;
int result = ReadAndStore(fileContents);
if(result==-1)
{
printf("Error reading file");
return 1;
}
FILE *out = fopen("outfile","w");
if(out==NULL)
{
printf("Error opening file");
return 1;
}
for(i = 0;i<result;i++)
fputs(fileContents[i],out);
printf("i've read %d lines\n",result);
fclose(out);
return 0;
}
|
|
|
|
|
hello,
i have a 2 classes each have a couple of functions and variable
the problem is: when i want to access a variable from class B inside a function in class A
it come up with Unhandled Exception says:
unhandled exception in "program name": 0xC0000005: Access Violation
<br />
<br />
class A<br />
<br />
{<br />
<br />
<br />
B* p_channel;<br />
<br />
<br />
inline BOOL StartIVR(){ p_channel->m_started = TRUE;
<br />
<br />
}<br />
<br />
class B<br />
<br />
{<br />
<br />
<br />
BOOL m_started ;<br />
<br />
<br />
}<br />
<br />
also any other access to any member in class B will result with the same exception
plz if anybody have any idea abt what's goin' on with this code, feel free to tell me :=)
thnx alot for ur time and concern
|
|
|
|
|
What are you trying to do? Can you show us a little bit more of your code?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
Define your class B on top A. and see to that you've specified "protected" or "public" to your BOOL m_started;
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|