|
Ghasrfakhri wrote:
you may only pay its post expense & 1$ for its CD.
Watch Buddy .. Priacy on open Forum is not allowed...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I appriecate the offer, but, I'm pretty sure that's not allowed. I'm gonna try copying the not working disc and burning it. Maybe the program will read where it's erroring and fix it.
Me, wrong!?! Nah, you just need to change your thinking to make me right.
|
|
|
|
|
|
I need to get the volume label (i need it for a removable device)
Does anyone know how can i do it???
Thanks!
|
|
|
|
|
Try GetDeviceInfo or another GetDevice* funciton.
|
|
|
|
|
Thanks...
But this API is not part of the visual C++ documentation.
I need a windows SDK API...
|
|
|
|
|
|
Thanks for the info... it's a big help...
I guess the volume label is not enough for me, i need also the name of the device - the one you see when you open my computer, right click on the device, click properties and click on the hardware tab (not general tab)
Do you know how can i get that name using windows API? Thanks!
|
|
|
|
|
Hi
I am relatively new to VC++ Programming.
Currently, I need to call DLL from VC++.
I have found a very good step by step from Hans Dietrich to do so
http://www.codeproject.com/dll/XDllPt1.asp
What are the additional steps I need to do if the Test.dll is not in the EXE's directory (step8)?
Assume the test.dll is in C:\DLLstore
|
|
|
|
|
swatch2468 wrote:
What are the additional steps I need to do if the Test.dll is not in the EXE's directory (step8)?
Assume the test.dll is in C:\DLLstore
If you are Linking Implicitly[^] to the DLL (as it's shown in the Hans Dietrich's tutorial[^] you cited), you'd need to either add "c:\DLLstore" to the PATH environment variable, or copy the DLL file to one of the predefined directories in which Windows will look for it. Take a look at the Search Path Used by Windows to Locate a DLL[^]
If you are Linking Explicitly[^] to the DLL, you can either a) use an absolute or relative path (e.g.: "C:\\DLLstore\\Test.dll") in the call to LoadLibrary[^], LoadLibraryEx[^], or AfxLoadLibrary[^] (if you are using MFC), or b) pass only the filename of the DLL (e.g., "Test.dll") to one of those functions, and again, either add "c:\DLLstore" to the PATH environment variable, or make sure the DLL is copied to one of the places where Windows will look for it.
--
jlr
http://jlamas.blogspot.com/[^]
-- modified at 22:50 Sunday 9th October, 2005
|
|
|
|
|
you should SET system variable PATH=C:\DLLstore.
|
|
|
|
|
i want to create a login dialog box with username and password details stored in MS Access file.
i created a new CRecordSet class :
class CPasswordSet : public CRecordset
{
public:
CPasswordSet(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(CPasswordSet)
// Field/Param Data
//{{AFX_FIELD(CPasswordSet, CRecordset)
long m_ID;
CString m_Username;
CString m_Password;
//}}AFX_FIELD
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPasswordSet)
public:
virtual CString GetDefaultConnect(); // Default connection string
virtual CString GetDefaultSQL(); // Default SQL for Recordset
virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support
//}}AFX_VIRTUAL
// Implementation
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};
and a CDialog class as below with a CPasswordSet public variable m_passwordSet:
void CLoginDlg::OnBlogin()
{
CString str;
str = m_passwordSet.m_Username;
MessageBox (str); //i get nothing, empty string
m_passwordSet.Edit() //get error with this line
//debug assertion dbcore.cpp line 1620
}
may i know what's wrong??
|
|
|
|
|
heavenode wrote:
m_passwordSet.Edit() //get error with this line
//debug assertion dbcore.cpp line 1620
[...]
may i know what's wrong??
What exactly do you want to do at CLoginDlg::OnBlogin() ? Do you want to retrieve a user/password from the database, edit an existing one, or add a new pair? The call to Edit doesn't seem to make sense unless you already have a current record.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
The following is my code skeleton about searching something using a thread:
void CFindDlg::OnBtnBegin()
{
if (find.m_pThread)
Stop();
else
Begin();
}
BOOL CFind::Begin()
{
if (m_pThread)
return FALSE;
TRACE("***UPBegin():%X\n", m_pThread);
m_pThread = AfxBeginThread(FindProc, this);
TRACE("***DOWNBegin():%X\n", m_pThread);
return m_pThread != NULL;
}
UINT CFind::FindProc(LPVOID lpVoid)
{
pThis->m_pThread = NULL;
TRACE("***FindProc():%X\n", pThis->m_pThread);
return 0;
}
Here's the debug output:
//#1 first button click
***UPBegin()
***DOWNBegin():4D98A00// (1)returns a pointer to the thread.
***FindProc() //(2)calls CreateThread start executing the thread(set m_pThread to NULL)
//#2 second button click
***UPBegin()
***FindProc() //(1)calls CreateThread start executing the thread(set m_pThread to NULL)
The thread 0x9B0 has exited with code 0 (0x0).
***DOWNBegin():4D98A00// (2)returns a pointer to the thread.(Note: here m_pThread valid again)
So you can see #1 and #2 have a different resulting m_pThread,#1 has a NULL m_pThread, #2 has a valid m_pthread.
According to the MSDN: "AfxBeginThread creates a new CWinThread object, calls its CreateThread function to (1)start executing the thread, and (2)returns a pointer to the thread". if the executing sequence of (1)(2) stated here is critical then code snippet #1 seems contradicted. But somehow instead of #2, #1 is the correct executing sequence for me. Because my code rely on m_pThread == NULL to start the thread again after the button click.How do I enforce the #1 sequence every time the thread is created?
|
|
|
|
|
You have to use some sort of synchronization. Check out WaitForSingleObject() , CEvent , CCriticalSection , CSingleLock , etc. If you do not synchronize your threads they will run totally independant of each other and you will not be able to control how far or fast one thread runs in comparison to another.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I've got problem with inserting string values into a combo box before I do DoModal() on my dialog.
I use resource dialog editor to create a dialog (derived from CDialog class). I put combo box into the dialog and assign a control variable to that combobox (CComboBox cbTenant). My dialog class looks like this:
#pragma once<br />
#include "afxwin.h"<br />
<br />
<br />
<br />
class CAddGuestDlg : public CDialog<br />
{<br />
DECLARE_DYNAMIC(CAddGuestDlg)<br />
<br />
public:<br />
CAddGuestDlg(CWnd* pParent = NULL);
virtual ~CAddGuestDlg();<br />
<br />
enum { IDD = IDD_ADDGUESTDLG };<br />
<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
DECLARE_MESSAGE_MAP()<br />
public:<br />
CString edGuest;<br />
CComboBox cbTenant;<br />
CString edStartDate;<br />
CString edEndDate;<br />
CString edTenant;<br />
};
Now I want to use this class, so I write:
CAddGuestDlg dlg;<br />
<br />
dlg.cbTenant.AddString("Some string"); // <- program crashes here
dlg.DoModal();
HELP!
|
|
|
|
|
At the point that you are calling the AddString function, the MFC object for the CComboBox has been constructed, but it's window has not been created. The best place to initialize the combo box is in the OnInitDialog handler for the dialog box. At that point, the dialog and combo box windows have been created but not shown.
Software Zen: delete this;
|
|
|
|
|
|
Hello guys,
I would like to do something easy, or at least that seams to be easy ...
I have an old application based on dialogs.
I would like to modify it to resize its dialog window automatically depending on the screen size and resolution.
Something like :
- at the end of the my OnInitDialog() routine, I test the screen type
- if I am 800*600, I am ok
- if I am more, I resize the dialog window itself to fit the screen size and then I move and resize each of my controls depending on a ratio calculated on real resolution and 800*600.
Seems to be simple, no ?
But how do I do this :
- access the dialog window, resize it
- access each of its controls (lists, buttons, etc), change their position and size.
Thanks in advance
DD
|
|
|
|
|
qadddd_free wrote:
access the dialog window, resize it
Does this mean you're not changing the code in the app ? If you are, then setwindowpos is what you want
qadddd_free wrote:
access each of its controls (lists, buttons, etc), change their position and size.
The best way to do this is to call setwindowpos for all your controls in a handler for the WM_SIZE event, in other words, when your screen resizes itself, the controls also get sized to fit in the window.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello,
Good idea to put all my business in the OnSize() function.
My biggest problem now is to determine the position, length and height of each control depending on the screen resolution.
Thanks for help
Regards
DD
|
|
|
|
|
|
Hello,
It is not really what I was looking for because I would like to keep my code as is, just add the the routine that maximizes the dialog and re-organizes all the controls.
If I would like to do it as described in this article, I would have to change a big part of my code to create all controls independantly, etc ...
But never the less, I will have a look in the part that calculates the new position and size of the control ... )
Thanks
Regards
DD
|
|
|
|
|
Hi DD,
I don't think that you will have to change a big part of your code.
I didn't check it but try this in your OnInitDialog:
#include "anchor.h"
CDlgAnchor dlgAnchor;
CDlgMan dlgMan;
dlgMan.Load(hwndDlg, "Yours project path");
dlgAnchor.Init(hwndDlg);
for(int nIndex = IDC_FIRST_CONTROL ; nIndex < IDC_LAST_CONTROL ; nIndex++)
dlgAnchor.Add(nIndex, ANCHOR_ALL);
then , add the WM_SIZE handler , and add to it :
dlgAnchor.OnSize();
Good luck,
Eli.
|
|
|
|
|
Hi..
i would like to know how to repaint only the selected row rather than repainting the whole listcontrol.
thanks..
sourabh
|
|
|
|