|
I want to get the directory that a CFileDialog choses as its initial directory if the lpstrInitialDir of the OPENFILENAME structure is left empty.
There is an algorithm it uses to choose this directory (as explained in the OPENFILENAME documentation) but i want to be able to call a function (on something) to get me this directory without having to replicate this algorithm myself.
So i dont want to do either of what you suggested.
Cheers for your help.
Andy.
|
|
|
|
|
It is random. I have seen it initialize to the document directory. Other times it initializes to the system drive, C.
Kuphryn
|
|
|
|
|
I'm program a music program. How i can use winamp's visualization with my program. Where i can find some information? Thank you very much
Nothing
|
|
|
|
|
|
Can you tell me more exactly. thanks
Nothing
|
|
|
|
|
Are there products that contain gauge and dial widgets for use with Visual C++? I have use xDesigner (Linux) and the gauge, needle, scale, range widgets are handy to use.
|
|
|
|
|
There are a number of these libraries around for Windows. I think National Instruments is one company that does this. You will also find code here and on Codeguru for individual controls like guage etc. A Google search should help you find the main players in this space.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I have this situation:
I have a CDialog and in it some ctrl's. I Enumerate all the ctrl's in it to let another window take over (a CTabCtrl derived class) the ctrl's for itself - working as a delegate for the "real" other window (called Wr here) - the dialog. This I do in order to let pages of the tab-ctrl work with the ctrl-sets to mimic that the dialog is embedded into the tab. So on tab shown I go SetWindowPos(...) on all the child's etc.
I use ::SetParent(hWndNewParent, hWndChild) for taking over the ownership - all works just fine!
Now my problem: How do I STILL let the messages from all kinds of ctrls go to the Wr (dialogs in this case and later on CView's)? Say I press a btn. on tab 0 - now the BN_CLICKED generated as a result of this press go to hWndNewParent (the CTabCtrl derived) and I want to route it to the Wr. This wish is because we already have all msg-handlers installed in lots of Wr's and would like to have'm stay their - otherwise it's mixed into a CTabCtrl derived and - well; no good!
My sugestion is still to catch "all interesting" messages on the new object and then go in the direction of (pseudo): pTabDlg->PostMessage(msg)...
So in other words my CTabCtrl derived class is a delegate only. Can I do that? I can use any help I can possible get – thanks in advance!
Regards,
Michael Mogensen, mm it-consult dk.
><((((º> ·.¸¸.· ><((((º> ·.¸¸.· ><((((º>
|
|
|
|
|
Hi, I have a custom CTreeCtrl, the problem is that the HScrollbar is not more working correctly, because the rect of the item insert in the tree is different than the rect that i use paint. So i tried to implement my own HScrollfunction, i know the item length, and can set the Scrollbar with SetScrollInfo, that works perfectly i can also calculate the offset to scroll. I use the customdraw function to scroll the screen with setWindowOrg(xOffset,yOffset). As next i can catch nearly all mouse events and also set an offset, i have only one problem with the TVS_HASBUTTONS that is not working correctly (The offset i calculate has no influence), any idea why? Or is there another way to scroll, a custom treectrl? Is it not possible just to change the item length somehow? So the windows standard behavier of the treectrl would do the scrolling for me?
I would be happy for any help or ideas...
|
|
|
|
|
In VC,why I cannot open the project of CDex downloaded from "http://sourceforge.net/" ? Thank you first.
Rap off for you,for me,for our human.
|
|
|
|
|
maybe u have the wrong version of vc?
i can't open it either with .net 2002.
Don't try it, just do it!
|
|
|
|
|
I am using the VC6.0.
Is the reason the version???
If so,which version of VC can open it???
Rap off for you,for me,for our human.
|
|
|
|
|
How to capture the status that's getting displayed in command window(local system only) from another windows application..... any ideas????
thanks in advance
adi
|
|
|
|
|
Make the output text of that console app into a disk file instead of printing to the command window, and then read the contents of the file into a memory buffer and parse that buffer for your needs...
But how to do this in your program? here's a solution:
Dynamically generate a .BAT batch file in your program, the contents of this batch file is like this:
consoleApp.exe >> c:\output.txt
Here, consoleApp.exe is the filename of that console app you want to capture its output, and then launch this batch file via CreateProcess win32 API. After the end of console app, what its outputs are placed into the output.txt file...
Hope this helps.
|
|
|
|
|
I have post this Q on some message boards and I didd not get a god answer yet.
I'm writing a game server that has the incoming data on tcp and outgoing on UDP muticast. My questiisn is.
Is UDP muticast rerouted on the WAN (internet) or not.
Thanks.
|
|
|
|
|
internet does not support multicast!
Don't try it, just do it!
|
|
|
|
|
Every application (windows) has .rc file and corresponding resource.h file is there any way we can give the resource.h a different name and the classwizard will do any further modifcations of the resource to new .h file?
Thanx in advance.
Prakash.
My God is more powerfull Than Your God.
|
|
|
|
|
i don't know a method, but why do u need to rename it?
Don't try it, just do it!
|
|
|
|
|
I have a function written to switch views. I have created a menu item that has two sub menu. when the application is run the default dailog comes up. when i try to switch to the other view it is not working.
here is the code for switching the view.
void CMainFrame::SelectView(int viewID)
{
// CFrameWnd* pMainWnd = (CFrameWnd*)AfxGetMainWnd();
CView* pOldActiveView = GetActiveView(); // Get current view
// Get pointer to new view if it exists
// if it doesn't the pointer will be null
CView* pNewActiveView = (CView*) GetDlgItem(viewID);
// CView* pNewActiveView = static_cast<cview*>(GetDlgItem(viewID));
// If this is 1st time around for the new view,
// the new view won't exist, so we must create it
if (pNewActiveView == NULL)
{
switch(viewID)
{
case PEOPLEVIEW: // Create a People view
pNewActiveView = (CFormView*)new CPeople;
//pNewActiveView = (CView*)new CPeople;
break;
case RELATIONVIEW: // Create a Relationship view
pNewActiveView = (CView*)new CRelation;
//pNewActiveView = (CView*)new CRelation;
break;
default:
AfxMessageBox("Invalid View ID");
return;
}
// Switching the views
// Obtain the current view context to apply to the new view
CCreateContext context;
context.m_pCurrentDoc = pOldActiveView->GetDocument();
pNewActiveView->Create(NULL, NULL, 0L, CFrameWnd::rectDefault,this, viewID, &context); // the program exits with an error at this point. please help me solve this
pNewActiveView->OnInitialUpdate();
}
// Check whether there are any orders
SetActiveView(pNewActiveView); // Activate the new view
pOldActiveView->ShowWindow(SW_HIDE); // Hide the old view
pNewActiveView->ShowWindow(SW_SHOW); // Show the new view
pOldActiveView->SetDlgCtrlID(m_CurrentViewID); // Set the old view ID
pNewActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
m_CurrentViewID = viewID; // Save the new view ID
RecalcLayout();
}
|
|
|
|
|
I believe you need to at least specify WS_CHILD for the style, probably WS_VISIBLE as well so you can see it.
--
Joel Lucsy
|
|
|
|
|
This is how I do it.
I have two functions, one to create/add a new view to my app and the other to swap the views
void AddView(CWnd* pMainWnd, CView* pView, UINT nID)
{
CDocument* pCurrentDoc = ((CFrameWnd*) pMainWnd)->GetActiveDocument();
CCreateContext newContext;
newContext.m_pNewViewClass = NULL;
newContext.m_pNewDocTemplate = NULL;
newContext.m_pLastView = NULL;
newContext.m_pCurrentFrame = NULL;
newContext.m_pCurrentDoc = pCurrentDoc;
CRect rect(0,0,0,0);
char szTemp[64];
sprintf(szTemp, "ViewList%x", nID);
pView->Create(NULL, NULL,
(AFX_WS_DEFAULT_VIEW & ~WS_VISIBLE),
// views are created with the style of AFX_WS_DEFAULT_VIEW
// In MFC 4.0, this is (WS_BORDER | WS_VISIBLE | WS_CHILD)
rect, pMainWnd,
nID, &newContext);
pView->SendMessage(WM_INITIALUPDATE, 0, 0);
}
CView* SwitchView(CFrameWnd* pFrame, CView* pNewView)
{
CView* pActiveView = pFrame->GetActiveView();
UINT temp = ::GetWindowLong(pActiveView->m_hWnd, GWL_ID);
::SetWindowLong(pNewView->m_hWnd, GWL_ID, temp);
if(pActiveView == pNewView)
return pActiveView;
// Resize new view to fit the frame - bug fix MB 14/03/02
CRect rect;
pFrame->GetClientRect(&rect);
pNewView->MoveWindow(&rect);
pActiveView->ShowWindow(SW_HIDE);
pFrame->RecalcLayout();
pFrame->SetActiveView(pNewView);
pNewView->ShowWindow(SW_SHOW);
pNewView->Invalidate();
return pActiveView;
}
// Each view needs an ID
#define VIEWS_CALLLIST_VIEW AFX_IDW_PANE_FIRST
#define VIEWS_TRANSFER_VIEW AFX_IDW_PANE_FIRST + 1
// In the WinApp derived class, create the views
void CReceptionApp::SetupViews()
{
// Get the primary view
CView* pActiveView = ((CFrameWnd*) m_pMainWnd)->GetActiveView();
m_pReceptionView = (CReceptionView*) pActiveView;
// Create the second view
m_pTransferView = new CTransferView;
AddView(m_pMainWnd, m_pTransferView, VIEWS_TRANSFER_VIEW);
}
// Switch the view - I usually call this in the CMainFrame class
SwitchView(this, GetApp()->GetTransferView());
Michael
|
|
|
|
|
Hi,
Whenever a pointer is not allocated, something like this,
CClass *myObj;
It is pointing to some address like 0xccddff.
I know that the address is junk. Why it is always like 0xccdeff or 0xdeffcc?? Why it is not like 0x102033??
So, before allocation of memory it is pointing to some place, which is junk. But, where is that junk area? or which is the area used where the not allocated pointer points to?
Best Regards,
A.Ilamparithi
|
|
|
|
|
The compiler sets this up for you (in debug builds only) so that you can find bugs quickly if you accidentally use the pointer without initializing it. It also does a similar thing with dynamically allocated blocks of memory.
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 1.1.4 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
|
Hello, i've got a problem with a Combobox as dropdown! If I have changed the Edit Control, I would paste the EnterKey! I have no reaction! How I can find the VK_RETURN ?
please help
|
|
|
|