|
use this little code
CCleintDC dc(this);
COLORREF ref;
int i=0;j=0;
for(;i<288;i++)
for(j=0;j<352;j++)
{
ref=RGB(red[i][j],green[i][j],bluew[i][j]);
dc.SetPixel(i,j,ref);
}
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Can I declare a global variable in a DLL?
My variable is a object of Internal class that NOT exported.
Also my global object will use internally.
My dll is a "Regular DLL with MFC statically linked".
Does it cause a problem?
|
|
|
|
|
Behzad Ebrahimi wrote:
Can I declare a global variable in a DLL?
Yes.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
But How Mr David
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
The same way you would in an EXE. If the variable is not within the scope of a function, it has file scope, thus it is global. If you want to use the variable in a different file from which it is declared, you'll need to extern it.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
how can I force WinXP to set the TCP/IP push bit when sending data on a socket that I created.
Rudolf
|
|
|
|
|
if you are using RAW_IP sockets, then yes.
Don't try it, just do it!
|
|
|
|
|
i have an odd run time error occuring my app. it is a simple SMTP program. when i select button1 it opens a CFiledialog as it should if i select "cancel" it works as it should no problems, but if i select "ok" the selected file path is returned as it should, however when the message is sent no data is written to the log file.
this occurs even if the path returned is removed before sending the data it follows the same code path as if i had not selected a path
the button code is as follows
void CMail2Dlg::OnButton1()
{
UpdateData(); // saves control data to variables
// Create an instance
CFileDialog fileDlg( TRUE, NULL, NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY, "All Files (*.*)|*.*||", this);
// Initializes m_ofn structure
fileDlg.m_ofn.lpstrTitle = "Attach File";
// Call DoModal
if ( fileDlg.DoModal() == IDOK) // seems to be the cause of the problem!!!!
{
CString szlstfile = fileDlg.GetPathName(); // This is your selected file name with path
m_att = szlstfile; //sets path to a variable of my main modal dialog
UpdateData(FALSE); //variables to controls
}
}
// the following code is writing of data to a file which occurs in various functions
ofstream logc ("logs.txt",ios::out | ios::app);
if (logc.is_open())
{
logc << rVal; // rVal is the data
logc.close();
}
please could any1 help
|
|
|
|
|
ChrisBidmead wrote:
i have an odd run time error...
And that error is??
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
there is no error message! the problem is that it just seems to ignore the output to the txt file
|
|
|
|
|
It does not appear that the CFileDialog code and the ofstream code are in any way related. True?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
the ofstream code is run weather or not the CFileDialog code is. so not they are not related
|
|
|
|
|
Ok, so are we looking at two separate issues here? I tried your ofstream code and it worked fine. I did not try the CFileDialog code but it looked correct.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have an application that was created using VC++ that does not restore when it is minimized on the Task Bar. Well, technically, it will restore if you right-click on it and select "Restore," but it does not restore if you just click on it. I suspect that it may be related to the fact that the app has no menu, but that isn't supported by any data. I haven't seen any mention of anyone with a similar problem, so I thought I'd ask here if anyone has encountered similar problems and if there are any solutions.
|
|
|
|
|
Hello,
I am trying to create a function which will return different members of my class according to an enumeration. The thing is that the different members do not have the same type : one of them is a CArray<int,int>, the others are CArray<int*,int*>, and I might have other arrays later on.
So in the .h file for the class, I created a template function in the following way :
CMyDataClass{
template <typename t="">
CArray<t,t>* GetDataList(LIST_TYPE t){
switch(t){
case t1 :
return &m_1; (let's say m1 is a CArray<int,int>)
break;
case t2 :
return &m_2;
break;
case t3 :
return &m_3;
break;
}
};
}
Everything builds fine.
However, when in another class I try to call the template function, say to retrieve m_1 :
CArray<int,int>* datalist;
datalist=MyClass->GetDataList(CMyDataClass::t1);
I get the following compilation error :
>>>class CArray<t,t> *__thiscall CMyDataClass::GetDataList(enum >>>CMyDataClass::LIST_TYPE)' : could not deduce template argument for 'T'
I don't see whether I have badly written my template function, or if it is the call to this template function that is wrong.
Could anyone give me some advice please ?
Thanks in advance.
|
|
|
|
|
my project focus on serial communication
i want to send text file using it
and i dont know how, can any body help me?
|
|
|
|
|
You need to look at the CreateFile Api. Serial Reading and writing on windows is done the same way file writing is done.
Best Of Luck
Forever Developing
|
|
|
|
|
Search for CSerialPort Class IN CP,that will solve your problem
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
hi all,
I am using Visual C++,MFC for My Project. I added a Combo Box to the Dialog.Now I want to add Integer typed variable to the ComboBox.But In the ClassWizard ,"Add Member Variable" Dialog Box, There is no room for integer type.So can't we add integer type as Member variable using class wizard to ComboBoxes?.If possible ,How do I do that ?
expect a answer...
thanks..
|
|
|
|
|
1.first you make member variabel as a string,
such as : m_strTest.
you add using class wizard.
2.then you add data for the ComboBox
3.if you want to get data from combo box, follow this code :
int intData;
switch(atoi(m_strTest))
{
case data you insert1:
intData= 1;
break;
case data you insert2:
intData= 2;
break;
}
UpdateData(FALSE);
|
|
|
|
|
yes .that is right. I mean that,Is there direct way to add integer type Variables to ComboBoxes..
I saw in some programs ,they directly use integer type like this:
void network::DoDataExchange(CDataExchange* pDX)
{CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(network)
DDX_CBIndex(pDX, IDC_COMBO1, m_Band);
//}}AFX_DATA_MAP
}
m_Band is a integer variable.
So there must be a direct way to add integer type variable for a comboBox using Wizard.
if any one know that,send me a reply....
thanks..
|
|
|
|
|
pubududilena wrote:
Is there direct way to add integer type Variables to ComboBoxes
Yes.
for (int nIndex = 0; nIndex < 10; nIndex++)
{
CString strIndex;
strIndex.Format("%d", nIndex);
m_combobox.AddString(strIndex);
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hello guys....
i want to execute device manager using WinExec in MFC Vis C++
The File name is devmgmt.msc
when i execute using run in windows, it can run.
But when i used it using mfc, it can't run
can somebody help me ?
The Code I wrote :
WinExec("C:\Winnt\system32\devmgmt.msc",SW_SHOW);
|
|
|
|
|
ShellExecute() won't work?
[insert witty comment here]
bdiamond
|
|
|
|
|
using WinExec you should call "C:\WINNT\system32\mmc.exe C:\WINNT\system32\devmgmt.msc".
Don't try it, just do it!
|
|
|
|