|
The dialogs and dialog bars create the controls based on the selected font during creation. Is there any way to dynamically reposition/resize all controls and the dialogbar, when the font is changed?
I am now able to do it only before creation.
Thank you
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Hi,
I use the Video For Windows function AVIStreamGetFrame which returns a Packed DIB.
I then convert it to a DDB using the following code fragment:
HDC hDc=GetDC(NULL);
BITMAPINFOHEADER* bminfoheader;
BITMAPINFO* bminfo;
LPVOID bits;
bminfoheader=(BITMAPINFOHEADER*)lpbi;
bminfo=(BITMAPINFO*)lpbi;
bits = bminfoheader->biSize + (char *)lpbi;
HBITMAP hbitmap = CreateDIBitmap(hDc, bminfoheader, CBM_INIT, bits, bminfo, DIB_RGB_COLORS);
My concern is the colour usage parameter in createDIBitmap, could there be a situation where AVIStreamGetFrame returns a image which uses DIB_PAL_COLORS.
Would DIB_PAL_COLORS have any effect on calls to GetPixel and SetPixel, when the image is selected into a device context.
Thanks Again
Richard
|
|
|
|
|
I use createprocess() to execute "notepad" in my application.
I want to show .txt file in it.How can I do this?
|
|
|
|
|
Depending on how you use CreateProcess() there's different ways to do it. In one of the parameters you write something like notepad.exe , just write notepad.exe c:\\test.txt or whatever you call your document then notepad should open it...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I used this code:
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset (&si, 0, sizeof (STARTUPINFO));
memset (&pi, 0, sizeof (PROCESS_INFORMATION));
si.cb = sizeof (STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
si.wShowWindow = SW_SHOW;
CreateProcess("c:\\WINDOWS\\notepad.exe c:\\My Documents\\test.txt",NULL,NULL,NULL,NULL,
CREATE_DEFAULT_ERROR_MODE,NULL,NULL,&si,&pi);
????It doesn't work?
|
|
|
|
|
Try with CreateProcess("c:\\WINDOWS\\notepad.exe \"c:\\My Documents\\test.txt\"",NULL,NULL,NULL,NULL,
CREATE_DEFAULT_ERROR_MODE,NULL,NULL,&si,&pi);
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
You have problems with My Docuements, I found the solution converting to ShortPath.
You must to execute with C:\\windows\\notepad.exe C:\\My documents\\test.txt
But C:\\My documents\\test.txt must be used with short path, because the application found a space between My and Documents.
For convert use GetShortPathName(). Or put the test.txt field in other directory without spaces...
Best Regards
Carlos Antollini.
|
|
|
|
|
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.
|
|
|
|