|
Behzad Ebrahimi wrote:
Do NOT conflit refrence and value!
In MSDN --> void GetClientRect( LPRECT lpRect ) const;
So use m_SearchBtn->GetClientRect(&the_rect);
HRGN region_handle = CreateEllipticRgnIndirect(&the_rect);
CRect has an operator that returns an LPRECT or LPCRECT, so his code was perfectly valid.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks Ryan. You are right.
I always use refrence tag to take my code more readable.
|
|
|
|
|
I write the folowing code which is taking RAM and Hard disk capacity from user by using structures and than saving it to a new file after the user complete entring data it is displaying data entered by the user by opening that file. Problm is that i want to ask the user to choose an option (y/n): If user enter y then your program again get the next record of computer specification i.e RAM capacity and hard disk capacity and store the information in file. And when the user enter n it will stop getting information and display the data of the file. For this i use do while construct but it is not working properly it is getting data but displays only last entry. plz tell me wat should i do.
the code is:
#include <conio.h>
#include <iostream.h>
#include <fstream.h>
struct computerspec
{
int ram;
int hdisk;
}compuspec;
void main()
{
char ch;
do
{
//prompt the user to enter RAM capacity
cout<<"Enter the RAM capacity"<<endl;
cin>>compuspec.ram;
cout<<endl;
prompt="" the="" user="" to="" enter="" hard="" disk="" capacity
cout<<"enter="" capacity"<<endl;
cin="">>compuspec.hdisk;
cout<
|
|
|
|
|
The problem in your code is that u are writing the file after the do while loop, and therefore if u write the file after the do-while construct it would write the last values. Write the values to the file in the do-while loop. After every time you obtain the values from the user write it to the file and then ask for the y/n thing.
I mean just before this
cout<
|
|
|
|
|
How can I convert a int to a char??
|
|
|
|
|
|
How? can you show me an exemple?
|
|
|
|
|
Larsson wrote:
How can I convert a int to a char??
Do u inquring about char *
[itoa]
if char:simple casting will help!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
[code]
int nNum=10;<br />
char szNum[5];<br />
<br />
itoa(nNum,szNum,10);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
TCHAR szBuffer[16];
INT iValue = 5;
::wsprintf (szBuffer, TEXT("%d"), iValue);
|
|
|
|
|
char szNum[30];
int i = 1234;
itoa(i,szNum,10);
// szNum now = "1234"
|
|
|
|
|
The type safe and portable way
Convert any type for which an ostream << operator is defined.
template<class T>
std::string to_string(const T &t)
{
std::stringstream ss;
ss << t;
return ss.str();
}
Use std::string::c_str() to retrieve char*
|
|
|
|
|
I have several projects in vs6 which I'm trying to convert to vs7. In vs6 I have html context sensitive helps which fail to work in vs7.
I tracked down the problem to OnCommandHelp which is where it goes when I press F1 on an area of interest. The following in the vs6 implementation:
LRESULT CFrameWnd::OnCommandHelp(WPARAM, LPARAM lParam)
{
if (lParam == 0)
{
if (IsTracking())
lParam = HID_BASE_COMMAND+m_nIDTracking;
else
lParam = HID_BASE_RESOURCE+m_nIDHelp;
}
if (lParam != 0)
{
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->WinHelp(lParam);
return TRUE;
}
return FALSE;
}
What happens is lParam gets a number, and through pApp it points to my application and goes to WinHelp. This all works very well.
In vs7 for some strange reason lParam is zero. This is the first mystery. The other strange thing is that instead of pApp->WinHelp, there is pApp->WinHelpInternal. I wouldn't mind changing the name from WinHelp to WinHelpInternal, but it isn't getting a non zero value for lParam up front.
Can anyone suggest what needs to be changed? I can't convert over to vs7 until I fix this problem.
Thanks,
Ilan
|
|
|
|
|
How create 3 D Push Button control in dialog?
thanks in advance.
|
|
|
|
|
thiyags wrote:
How create 3 D Push Button control in dialog?
http://www.codeproject.com/buttonctrl/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
How can I edit the Active Directory from my application? I mean to add users, to read from Active Directory, etc...
Thanks in advance!
Have a nice day!
|
|
|
|
|
//adding a user
void AddUser(LPWSTR UserName,LPWSTR UserPassword)
{
CoInitialize(NULL);
IADsContainer *container;
LPWSTR ADPath = L"LDAP://serv1/CN=Users,dc=codeproject,dc=com";
hr = ADsOpenObject(ADPath, UserName, UserPassword, ADS_SECURE_AUTHENTICATION, IID_IADsContainer, (void**)&container);
IDispatch *pDisp;
hr = container->Create(L"user",L"cn=Efter",&pDisp);
container->Release();
IADsUser *pUser;
hr = pDisp->QueryInterface(IID_IADsUser,(void**)&pUser);
pDisp->Release();
VARIANT var; VariantInit(&var);
V_BSTR(&var) = L"Yevgeny";
V_VT(&var)=VT_BSTR;
hr = pUser->Put(L"samAccountName",var);
hr = pUser->SetInfo();
VariantClear(&var);
pUser->Release();
CoUninitialize();
return 0;
}
|
|
|
|
|
Hi,
I am working with SDI application in MFC. When I click on the restore button on the system menu of the MainFrame window, the window dimensions should be set to 2/3 the width and height of the screen resolutions.
Can anyone please suggest, where and how to handle this event?
Thanks
Madhavi.
|
|
|
|
|
void CMainFrameWnd::OnSize(UINT nType, int cx, int cy)
{
if(SIZE_RESTORED == nType)
{
// Use GetSystemMetrics function to obatin Display related information
// apply your logic here for resizing
}
}
Regards
Abhi
|
|
|
|
|
Hello,
I would like to ask if anyone knows if there are any tutorials and code samples for using libpqxx, because searching the net did not helped me out :/
|
|
|
|
|
Hi
I am working with CFileDialog in MFC SDI application. When I open a file for ex: test.txt from File->Open menu, the contents of the file are read and displayed on the view. When I select, File->Save option to save the contents of the file, a CFileDialog is displayed. When the selected file from CFileDialog is the same file as the opened one i.e test.txt, then a special message should be displayed to the user and the default windows warning message asking for replacing the file should not be displayed. However if any different already existing file is selected, then the default windows warning message should be displayed. In other words, I want to ovveride the function that is called when we click on CFileDialog's save button.
Can anyone please give me some inputs for doing this?
Thanks
|
|
|
|
|
The CFileDialog has a m_ofn data member that is the OPENFILENAME structure used by the underlying common dialog.
There is a lpfnHook member of that structure that allows you to intercept messages before the dialog processes them. In that hook you can react to what happens when the user commits the dialog with a specific filename being selected or not selected.
Search the MSDN documentation for OPENFILENAME and lpfnHook for more information and possibly examples/samples.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I am trying to build a Java launcher for a Java Product. Executing a Java application with a Batch file looks akward. I want a write code so that a native application written in VC++ can launch the Java application. The batch file of the application looks like this
---------------------------------------------------------------------------------------------------
set path=%PATH%;.\java\j2re1.4.2_07\bin;.\java\j2re1.4.2_07\lib;.\JMF2.1.1e\bin;
set classpath=.\JMF2.1.1e\lib\sound.jar;.\JMF2.1.1e\lib\jmf.jar;
java -classpath Sample.jar;%CLASSPATH%;%JMFHOME% -Djava.library.path=./Samplelib NrthSample.SampleMainApplication
---------------------------------------------------------------------------------------------------
Is there any way to lauch the Java application straight for the native application without the batch file? Can someone tell me which functions to use??
Regards.
|
|
|
|