|
Use ShellExecute() instead, which will automatically run the app associated with .TXT files.
--Mike--
http://home.inreach.com/mdunn/
#include "witty_sig.h"
your with and
|
|
|
|
|
You should be able to include the file name you want opened on the command line parameter (2nd argument in CreateProcess).
e.g. "notepad.exe c:\test.txt"
Hope this helps,
Bill
|
|
|
|
|
Help me please
I am not able to find my semantic error
I want a pointer to the document (MDI, Doc/View) in the application class.
I tried this way:
void CMyApp::OnFileNew()
{
CWinApp::OnFileNew();
CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
CMyDoc* pDoc = (CMyDoc*)pFrame->GetActiveDocument();
pDoc->SetModifiedFlag(); //Error: Access Violation!!!!!!!
}
Why is pDoc not a pointer to the active document??????
Any suggestion would be very appreciated
thanks in advance
regards
jens
[email]sport(at)web,de[/email]
|
|
|
|
|
I have'nt tried the solution you suggest, and I don't know why it fails. But since the document has nothing to do with the frame class, you should obtain it from the Application class. Copy and paste this code into you CMyApp class:
CCommixDoc* CCommixApp::GetActiveDocument()
{
POSITION pos = GetFirstDocTemplatePosition();
ASSERT(pos);
CDocTemplate* pTempl = GetNextDocTemplate(pos);
ASSERT(pTempl);
pos = pTempl->GetFirstDocPosition();
ASSERT(pos);
if (pos==NULL)
{
return NULL;
}
return (CCommixDoc *)pTempl->GetNextDoc(pos);
}
Christian Skovdal Andersen
"I have a plan so cunning you could put a tail
on it and call it a weasel." -Edmund, Blackadder III
|
|
|
|
|
Hi christian
thanks a lot. I have tried your solution and it works in this case very good
My aim is to open several documents with the belonging childwindows depending on a loop in a global function. And fill the data member of the document class
When i try your solution in the global function:
CMyApp * pApp = (CMyApp *)AfxGetApp();
CMyDoc * pDoc = pApp->GetActiveDocument();
and try to fill the data member of the document class:
pDoc->m_data = x;
i get an error
in your function GetActiveDocument() in the evaluation line:
ASSERT(pos);
Can you explain me this behavior?
What is my error in reasoning?
thanks in advance
regards
jens
|
|
|
|
|
E-mail me a sample, that have the error, and I'll take a look at it.
Christian Skovdal Andersen
"I have a plan so cunning you could put a tail
on it and call it a weasel." -Edmund, Blackadder III
|
|
|
|
|
Hi Christian,
thank you very much for your readiness to help me in this way!
As you can see below, I could solve my problems.
best wishes
jens
|
|
|
|
|
If you have an MDI app you need to go
AfxGetApp()->MDIGetActive()->GetActiveView->GetDocument(); ( or possibly AfxGetApp()->MDIGetActive()->GetActiveDOcument();, but I'm not sure on that one ).
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Great! fantastic! excellent!
Thank you very mutch for your suggestion
It works fine.
Some small correction:
MDIGetActive() is not a element from derived CWinApp class (CMyApp), but CMDIFrameWnd::MDIGetActive. So I insert a pointer to the CMainFrame:
CMainFrame* pmyFrame = (CMainFrame*)AfxGetMainWnd();
ASSERT_VALID(pmyFrame);
CMyDoc * pmyDoc = (CMyDoc*) pmyFrame->MDIGetActive()->GetActiveDocument();
ASSERT_VALID(pmyDoc);
thank you
regards
jens
|
|
|
|
|
HOWTO: Get Current CDocument or CView from Anywhere
Article ID: Q108587
werks fer me, eh...
|
|
|
|
|
Hi Tim
Maybe I am blind.
How can I find this article?
thanks in advance
regards
jens
|
|
|
|
|
This is a Miscosoft Knowledge Base (KB) article from the MSDN - if you don't have the MSDN Library installed, you can go to msdn.microsoft.com and search for the article (Q108587) number.
|
|
|
|
|
Does anyone know how can I writing addtional modules (DLL) to Microsoft Flight Simulator? In SDK isn't nothing about it ;-(
If You know, please tell me it...
Eml: piopawlu@interia.pl
|
|
|
|
|
I have some code that draws a filled rectangle with a CBrush and FillRect() , changes the window origin, and then continues to draw lines with a CPen . My problem is that the lines are being drawn behind the filled rectangle, and messing with the window origin with SetWindowOrg() seems to be doing it. Commenting out my call to SetWindowOrg() draws the lines on top.
Why is it doing this?
Simon
Hey, it looks like you're writing a letter!
Sonork ID 100.10024
|
|
|
|
|
This has been resolved.
Simon
Hey, it looks like you're writing a letter!
Sonork ID 100.10024
|
|
|
|
|
Here is my code:
DWORD dwMask;
CHARFORMAT cf;
dwMask = m_wndChild.GetDefaultCharFormat(cf);
cf.dwMask = dwMask | CFM_COLOR ;
cf.dwEffects ^= CFE_AUTOCOLOR;
m_wndChild.SetWindowText(m_sTexto);
COLORREF Gris = RGB (192,192,192);
COLORREF Azul = RGB (20,20,200);
COLORREF Azul_Claro = RGB(50,50,255);
COLORREF Verde = RGB (0,255,0);
int Tamano_Array = m_arrPosicIluminar.GetSize();
for (int i=0; i < (Tamano_Array / 2);i++)
{
m_wndChild.SetSel(m_arrPosicIluminar[i*2],m_arrPosicIluminar[i*2+1]);
cf.crTextColor = Verde;
// cf.crBackColor = Gris; //This is not possible
m_wndChild.SetSelectionCharFormat(cf);
}
m_wndChild.SetSel(-1,0);
Thanks in Advance.
|
|
|
|
|
Sorry. I found the answer in a previous thread.
"You can set a background color for selected text using RichEdit 2.0 or later. Just pass CHARFORMAT2 structure to CRichEditCtrl::SetSelectionCharFormat and set crBackColor member to whatever you want."
|
|
|
|
|
Has anyone got any code/example how to create/use a CListCtl with a CHeaderCtl using WTL? (NO MFC!!!)
Ignorance sould be pitied, not flamed.
|
|
|
|
|
Hi all,
I'm writing Dialog-base program ...
I have created Toolbar for my program ... (with CToolBar)
Now, i wanna set Tooltip for my buttons in the toolbar ...
I wrote this code, but won't work !
This code have not any error or warning but don't show tooltip !
Sometimes it crashes !
PLEASE HELP ME !
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXT, 0, 0xFFFF, OnTooltips)
// 0 and 0xFFFF aren't my button's ID in my toolbar, i write below code too, but won't work
// ON_NOTIFY_EX_RANGE(TTN_NEEDTEXT, IDC_BUTTON1, IDC_BUTTON8, OnTooltips)...
BOOL CLoanDialog::OnTooltips(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT*)pNMHDR;
UINT nID = pNMHDR->idFrom;
if(pTTT->uFlags & TTF_IDISHWND)
{
nID = (UINT)(WORD)::GetDlgCtrlID((HWND)nID);
if(nID)
{
strcpy(pTTT->szText, "Hadi"); // I want to show Hadi string for all buttons ...
*pResult = 0;
return(TRUE);
}
}
return(FALSE);
}
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Toolbars supprt their own built in tooltips. You should be able to set them up as follows:
When creating the toolbar, and looking at the properties of each button, you can enter a string which is the staus bar prompt. The tooltip of the button can be entered in the format:
"Status bar prompt"\n"Tooltip"
Just set the associated text for each button.
You may need to call EnableToolTips on your toolbar to get he me to work. I have never used a toolbar in a dialog project, but it should work this way.
Roger Allen
Sonork 100.10016
|
|
|
|
|
Hi Roger,
I did thease works, but i have problem, still
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
|
|
|
|
|
I use CDaodatabase to open the mdb file,
I use the code follow:
try
{
m_db.Open(m_Source,FALSE,FALSE,_T(""));
}
catch(CDaoException* e)
{
e->Delete();
return false;
}
return true;
but every time it throw a error code
|
|
|
|
|
Since you haven't posted enough code we can only guess.
If you have kept the mdb open in Access , then Access has exclusive access. Close Access before running your code.
That might be the problem.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
That could be it, although, to my knowledge, Access 97 doesn't demand exclusive access to the .mbd it has open. At least, my application can read the database without any problems. Quite handy since i can modify the database in Access, and have my app redraw the results by invalidating the view.
Simon
Hey, it looks like you're writing a letter!
Sonork ID 100.10024
|
|
|
|
|
It works better (sharing wise) if you have your tables seperate from the code/views etc. Its also handy to have your queries external.
Access's own user login bit has never seemed to quite get the hang of sharing. With a sort of random selection of locking techniques, one record or whole table.
This all seems to be ok once your tables are seperated.
Another point, which will no doubt cause a scrap amongst us all, is that I tend towards a non Access data type. DBase IV is a favourite, since it can be made accessible from many different language/office apps and you have a wide range of ODBC drivers that your own code can use.
(I'll wait behind the bike sheds for the first up)
We do it for the joy of seeing the users struggle.
|
|
|
|