|
Thank you for the help CPallini, the explanation that you gave will also work for more than one header file and cpp file (Class - Base Classes [files]) ???
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Use
/force switch in linker option.
Come online at:-
jubinc@skype
|
|
|
|
|
Thanks for the reply, what would /force do ??
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
/force sounds unwise, you should fix the problem by using extern in the headers and only defining the variables once. To see what /force does check the documentation.
I know that programming style and naming conventions are controversial, but global variables called i, n ??? How about something more descriptive?
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
cp9876 wrote: I know that programming style and naming conventions are controversial, but global variables called i, n ??? How about something more descriptive?
lol, I totally agree, but when pasting an example on the CP, I don't like using the full variable name
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi,
I am new to vc++.net (mfc),i need to know how to add data and column headers to the MSDATAGRID VERSION 6.0 dynamically IN vc++.Net(mfc application), Please Some one help me
Thanks in advance
Engilela
-- modified at 6:26 Friday 13th April, 2007
|
|
|
|
|
Hi all,
Take the following into consederation:
header file
class ftp :
public ftpHook
{
public:
int ftp_FileExists(LPSTR Filename);
LPSTR ftp_StrChr(LPSTR StringPtr, char Ch);
};
cpp file
#include "ftp.h"
int ftp::ftp_FileExists(LPSTR Filename)
{
Ptr = ftp_StrChr(PathBuffer+lstrlen((LPSTR)LocalDir)+1,':');
}
</code>
But I keep receiving the following error:
Error 1 error LNK2019: unresolved external symbol "public: char * __thiscall ftp::ftp_StrChr(char *,char)" (?ftp_StrChr@ftp@@QAEPADPADD@Z) referenced in function "public: int __thiscall ftp::ftp_FileExists(char *)" (?ftp_FileExists@ftp@@QAEHPAD@Z) ftp.obj
Can anyone please help me.
Many Thanks.
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
|
Look, you make a call to ftp::ftp_StrChr [inside ftp::ftp_FileExists] but this function is not defined [it has no body]. So define that function.
--
======
Arman
|
|
|
|
|
|
hi all!!!
i have already split file by size eg. for window media format file (wmv/wma).
but now i want to split file by play length like suppose i take %age in the edit box
and it will parts that file with all equal size and remaining with the rest.
thanks in advance
|
|
|
|
|
The purpose of splitting is uncertain...
What's the problem? You have the file length and the persentage, so define the split position = (length*percent)/100. Or you wonder smth else?
--
======
Arman
|
|
|
|
|
hi! i've made a custom control button. the problem is when i click the button, the icon "disappears". when i switch to other window and back again to my app, the icon is displayed again. i think it doesnt repaint properly. here's my code in OnPaint(): It only happens in Windows 2000, not in Win XP
void CIconBitmapButton::OnPaint()
{
__super::OnPaint();
CDC* pDC = this->GetDC();
SendMessage(WM_ICONERASEBKGND, (WPARAM) pDC->GetSafeHdc(), 0);
RECT canvasArea;
GetClientRect(&canvasArea);
int iconX = 0;
int iconY = 0;
ICONINFO iconInfo;
GetIconInfo(this->m_hIcon, &iconInfo);
HDC hDC = pDC->m_hDC;
CBitmap* iconBitmap = CBitmap::FromHandle(iconInfo.hbmColor);
CBitmap* maskBitmap = CBitmap::FromHandle(iconInfo.hbmMask);
BITMAP iconSize;
iconBitmap->GetBitmap(&iconSize);
iconX = iconSize.bmWidth;
iconY = iconSize.bmHeight;
// NOTE: icon must be drawn with these coordinates
int buttonX = canvasArea.right/2 - iconX/2;
int buttonY = canvasArea.bottom/2 - iconY/2;
pDC->DrawIconEx(buttonX, buttonY, this->m_hIcon,0,0,0,brush, DI_IMAGE);
// if (m_stretch)
ReleaseDC(pDC);
DeleteDC(hDC);
iconBitmap->DeleteObject();
maskBitmap->DeleteObject();
// if (this->m_hIcon)
}
|
|
|
|
|
Seems there is a problem in last lines of the function. Don not call DeleteDC(hDC); the logic is that you do match a ReleaseDC per GetDC and this is all. Also you are wrapping a C++ object over iconInfo.hbmColor and iconInfo.hbmMask. These CBitmap objects are only temporary wrappers over underlying handles and thus do not call DeleteObject for them.
--
======
Arman
|
|
|
|
|
What I am looking to do is to provide the user (who runs my program) with a list of devices that they can pick from. You can do this with an Open File dialog if you click on "My Computer". What I want to know is how I can set up the dialog before the user opens it to prsent this list. How would you do this in C++? Have you seen it done before?
[IMG]http://i67.photobucket.com/albums/h292/Athono/_help.png[/IMG]
I want one of two (or both) solutions.
#1) I already have a custom File Open dialog program written where I am able to make sure that the user selects a directory and is not allowed to input a filename. Now I just want to know how to set up this estantiated FileOpen class so that it will first come up with the "My Computer" area showing.
OR
#2) I want to create a drop-down menu that only shows the devices for the user to pick from. In other words, just the C drive, the D drive, etc.
|
|
|
|
|
Sounds like you want SHBrowseForFolder
|
|
|
|
|
I made my own Dynamic array holder and now i want to read into it from a file i was wondering if anyone could kind of put me on the right track here is what i have.
struct item
{
char type[16];
char name[16];
unsigned int cost;
unsigned int weight;
};
int main()
{
int size;
string line;
DynArray<item> dline;
ifstream ifl;
ifl.open("items.shp", ios_base::in);
ifl >> size;
while(! ifl.eof())
{
getline(ifl,line);
dline.append(line); //line giving me errors
cout << line << endl;
}
ifl.close();
return 0;
};
I was thinking i might have to make a variable for each of them and then append one at a time. Any suggestions?
|
|
|
|
|
What about serialization [^]?
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.
|
|
|
|
|
hi there,
i'm building a SDI form application and thought it might be good to have a dialog box as a set of alternate controls for a few parameters of that application.. is this possible? i've created the dialog box resource but i'm having some trouble getting them to talk to one another..
for example - the main form contains a few slider controls for parameters and this all works fine, but i also want to be able to control these parameters from a seperate dialog box, and ideally i'd want them to correspond on submission (if moved in the dialog box, the original is updated..) is there any way to link 2 controls to 1 parameter? should i be working with a MDI?
thanks in advance!
|
|
|
|
|
As with any dialog, some member variables linked to the dialogs slider controls in the DoDataExchange should be sufficient. After the CDialog derived class is instantiated, have the view set the dialogs members. Once DoModal returns with IDOK, but before the CDialog derived class goes out of scope, your view code can get the last position of the slider and update its controls accordingly.
/*
Obviously, there will be more to it than this but the basic idea is the same
*/
void CTestsliderView::OnShowDialog()
{
// TODO: Add your command handler code here
CSliderDialog dlg;
dlg.m_nSlider=15;
if (dlg.DoModal()==IDOK) {
TRACE("New Slider pos = %d\n",dlg.m_nSlider);
}
}
|
|
|
|
|
bob16972's idea is good, at the same time u can have "CSliderDialog dlg;" is the member of CTestsliderView class.so that across the view u can access ur dialog very easily.
|
|
|
|
|
thanks alot this looks like it will work for me,
however i've just had a quick look and when i try to set the position of the dialog slider from the view code (ie "dlg.m_nSlider.SetPos(0)) i get an assertion failure with "afxcmn.inl" which breaks at the SetPos function.. have i missed something?
in the dialog code i've set up a member variable linked to the dialog slider with DoDataExchange and i've also used OnInitDialog() to set the range of the slider.. but other than that i think its as above..
thanks in advance
|
|
|
|
|
You don't show code but I bet you're calling SetPos before the dialog is created. You need to do something like what you were shown originally by bob16972
CSliderDlg dlg (this);<br />
dlg.m_nSlider = <value>;
if (dlg.DoModal () == IDOK)<br />
{<br />
}
The actual call to SetPos should be from within the CSliderDlg's OnInitDialog. Also, you need to do something in your CSliderDlg::OnOK to put the position of the slider into the m_nSlider variable. I haven't played with sliders and DDX to know offhand if the DDX does this for you on slider controls.
Judy
|
|
|
|
|
You'll assert because the windows don't exist unless the dialog is modal (I'm not considering modeless since that comes with it's own set of issues). The dialog object does exist and that's where the members come into play.
Make sure the member variables you create are for the value and not the slider control. Notice that the member in the sample is of type int and not CSliderCtrl (You could create one of both so you can get to the control from within the dialog class, just remember not to use it if the dialog window does not exist.) Separate the dialog object from the window and the asserts will make more sense.
Hope that helps
|
|
|
|
|
thanks very much, fairly new to MFC so sorry if that was a bit obvious!
|
|
|
|