|
In OnSerialise, read and write the individual grid positions, and the other info you want ( grid size, column sizes, etc. )
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
OK. One last question I have pointer m_pGrid declared in C%Name%View how do I access it in C%Name%Doc? Thanks for the help.
-Matt Newman
|
|
|
|
|
CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
CMyView * pView = (CMyView*)pMain->GetActiveView();
pView->m_pGrid->etc.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I am using a for statment to go through it all but how would I create a variable based on the cell it is working on say CString CellXY X and Y being the cell's coordinates?
-Matt Newman
|
|
|
|
|
I haven't done any serialisation for *ages* but I wold do something like this:
ar << m_pGrid->GetColumns()
ar << m_pGrid->GetRows()
for (int x = 0; x < m_pGrid->GetColumns(); ++x)
for (int y = 0; y < m_pGrid->GetRows(); ++y)
ar << m_pGrid->GetData(x,y);
I don't know if ANY of these functions exist or if I'm serialising properly, but you get the idea. You'd need to save the number of rows & columns first for when you read back in.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Ok I think I have it.
-Matt Newman
|
|
|
|
|
The Grid has Load/Save functions that will read and write from comma delimited files. There is a serialize function someone sent in that I will merge eventually.
cheers,
Chris Maunder (CodeProject)
|
|
|
|
|
OK. I just find the whole Doc/View annoyingly confusing and stupid. Oh well.
-Matt Newman
|
|
|
|
|
I am trying to write a custom AppWizard. I would like my AppWizard to be able to enable the "Build browser info file" facility. I can see how to do this using the "Project>Settings" menu option, but I can not see how to get a custom AppWizard to do this automatically. I thought it might involve using AddToolSettings, but what is the name of the tool (Is it bscmake?) and what is the command option that you use?
|
|
|
|
|
Hi Anonymous,
The tool is bscmake.exe
Try the following:
VARIANT dummy = {0};
CString browseInfoFileName;
CComPtr<IConfiguration> pConfigs;
//Place the following line into the string above:
/o"\my_project\output_folder/project_name.bsc"
pConfigs->AddToolSettings(L"bscmake.exe",
browseInfoFileName.AllocSysString(), dummy);
Better late than never
|
|
|
|
|
Hi,
I would like to post a . I think I have found the right way to do it, but it just will not work. It only works if I want to post an URL (like http://www.foo.com/res.asp&name=bart), but not if it is alot of text.
Below is some sample code, that I would like to use for sending an SMS message programatically.
try{
CString strHeaders = _T("Content-Type: application/x-www-form-urlencoded");
CString strFormData = _T("afsender=boetos&modtager=5555554578&besked=this+is+a+test");
CInternetSession session;
CHttpConnection* pConnection = session.GetHttpConnection(_T("212.112.128.11"));
if (pConnection)
{
CHttpFile* pFile = pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, _T("/res.asp"));
ASSERT(pFile);
BOOL result = pFile->SendRequest(strHeaders, (LPVOID)(LPCTSTR)strFormData, strFormData.GetLength());
if (result)
{
CString strData;
CString strBuff;
while (pFile->ReadString(strBuff))
{
strData += strBuff;
strBuff.Empty();
}
FILE *f=fopen("res.html", "w");
if (f)
{
fprintf(f, strData);
fclose(f);
}
AfxMessageBox("Done!");
pFile->Close();
delete pFile;
}
}
pConnection->Close();
delete pConnection;
}
catch (CInternetException* pEx)
{
pEx->ReportError();
pEx->Delete();
return;
}
Can anybody tell me what goes wrong?
Regards,
Christian Skovdal Andersen
|
|
|
|
|
Hi all,
I wanna get file Created Date of file ...
I don't want to use MFC ...
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
time_t GetFileDateString(const CString &csFQSrcPath, BOOL bMod)
{
struct _stat buf;
int result = _stat( csFQSrcPath, &buf );
if( result != 0 ) {
return "?/?/?";
}
time_t ft = buf.st_ctime;
if (bMod)
ft = buf.st_mtime;
return ft;
}
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Hi Chris
Thanks for your helps, Your help was useful ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Check out GetFileTime().
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
I wanted to know how to set a permanent size to a control.
I have a dialog type application that is set to be 300x400 pixels in size, (the reason I permanently set the dialog box to this size is so that no matter what, if the end user sets their desktop to "Large fonts" the dialog always stays 300x400, I have other reasons too but you probably dont want me to go into them ) the problem is that the controls on the dialog box are enlarged. How can I permanently define the size of the controls so they never change?
Thanks
Rob Jones
|
|
|
|
|
Well, the coordinates and sizes of controls in .rc resource files are expressed in dialog base units, which are related to the default font size the user has chosen on the "Display Properties" box. This is so by design, and the guys from Microsoft regard it more as a feature rather than a problem. So, if you want to have all the controls back to the positions they should have in what you consider to be "normal font size", just add some code in OnInitDialog() to iterate over all of them and resize them (both position and dimensions) according to the scale factor lNormalDialogBaseUnits/::GetDialogBaseUnits() , where lNormalDialogBaseUnits is the value returned by ::GetDialogBaseUnits() under normal conditions. I'm afraid there's no other way to do it. Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for the fast response.. I'm pretty new to VC++, I have found in the .rc file my controls with the dimensions.. And I see the function GetDialogBaseUnits().. I just dont quite understand lNormalDialogBaseUnits .. Is this something I have to create my self? Right now I have in my OnInitalDialog(), GetDialogBaseUnits(); How do I point it to something that holds the demensions I want?
Can you provide me with a small sample of code..
Thanks again for all your help!
Rob
|
|
|
|
|
What I do is run the app in small fonts, and use Spy++ to get the position and size of all the controls. Then in OnInitDialog(), use SetWindowPos() to position the controls back to those original sizes and positions.
The fonts will still be larger though, so watch out for text that runs off the controls. You may have to mess with the font as well, or shorten any text that's too long in large fonts.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Thanks,
I tried GetDlgItem(IDC_EDIT)->SetWindowPos(NULL,x,y,w,z,NULL);
And everything seems to be ok.. I will take your advice and open spy and get the position and sizes of all the controls and go from there.
Thanks for everyones help.. If anyone still has a different way of doing the same thing I would still like to see other ways
Thanks again!!
Rob Jones
|
|
|
|
|
I'm afraid I cannot provide you with any consistent piece of code as I don't have a compiler at hand from where I am right now... I assume your problem is that you don't like how your dialog looks like when the user changes the font size of the system. So, set the font size of the system to what you're used to work with and write down the value returned by ::GetDialogBaseUnits() : This is what I call lNormalDialogBaseUnits , and it should be stored in your program as a constant. the ratio lNormalDialogBaseUnits/::GetDialogBaseUnits() is then the factor by which you have to shrink (or expand) controls to bring them back to the positions and sizes you intended in the first place. The code for doing that thus resembles this (be warned I've written this on the fly and chances are it won't even compile):
CWnd* pChildWnd = GetWindow(GW_CHILD);
while (pChildWnd)
{
CRect windowRect;
pChildWnd->GetWindowRect(windowRect);
CString strClass;
::GetClassName(pChildWnd->m_hWnd, strClass.GetBufferSetLength(32), 31);
strClass.MakeUpper();
if(strClass==_T("COMBOBOX"))
{
CRect rect;
pChildWnd->SendMessage(CB_GETDROPPEDCONTROLRECT,0,(LPARAM) &rect);
windowRect.right = rect.right;
windowRect.bottom = rect.bottom;
}
pWnd->ScreenToClient(windowRect);
windowRect.left = windowRect.left * lNormalDialogBaseUnits / ::GetDialogBaseUnits();
windowRect.right = windowRect.right * lNormalDialogBaseUnits / ::GetDialogBaseUnits();
windowRect.top = windowRect.top * lNormalDialogBaseUnits / ::GetDialogBaseUnits();
windowRect.bottom = windowRect.bottom * lNormalDialogBaseUnits / ::GetDialogBaseUnits();
pChildWnd->MoveWindow(windowRect);
pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);
} (The skeleton of this I got it from a Microsoft sample called PRPFONT you can find in the article "PRPFONT - How to Set CPropertySheet Fonts".)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
What do I set lNormalDialogBaseUnits to?
For example in the microsoft example they set TEXTMETRIC to lNormalDialogBaseUnits;
Sorry for all the questions.. But thanks for all the help
Rob
|
|
|
|
|
Never mind.. I figured it out.
Thanks everyone for all your help.
Rob
|
|
|
|
|
I just want to print a two (2) page document. When I print preview, I see the two pages. But if I zoom it, or view it as one page, the content disappears? Any ideas, any code on how to resolve this?
Please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
Hi,
I try to implement an ActiveX that creates a thread (through AfxBeginThread). This thread is calling a custom event. When I try to terminating the thread, it makes an uncaught exception. Even, when I try to communicate from the custom event with the activeX (by testing a property for example), I get a memory problem.
How can I solve these problems ?
Should i use any other method and if yes which one ?
thank you very much for your help.
|
|
|
|