using namespace Microsoft::Win32; Registry::SetValue("HKEY_CURRENT_USER\\SOFTWARE\\MyPath", "Desired_Value_Name", "Value");
Nigah M Manzoor
using namespace Microsoft::Win32; Registry::SetValue("HKEY_CURRENT_USER\\SOFTWARE\\MyPath", "Desired_Value_Name", "Value");
Nigah M Manzoor
your form class should be first class in the namespace, if there is other class before your form class, move that class.
Nigah M Manzoor
Microsoft::Office::Interop::Excel::Application^ exl = gcnew Microsoft::Office::Interop::Excel::ApplicationClass(); FileInfo^ file = gcnew FileInfo("c:\\leonigah.xls"); Workbook^ wb = exl->Workbooks->Open("c:\\leonigah.xls", 0, false, 5,"", "", true, Microsoft::Office::Interop::Excel::XlPlatform::xlWindows, "\t", false, false,0, true, true, 0); Worksheet^ ws = static_cast<Worksheet^> (exl->ActiveSheet); Range^ rn = (Range^)ws->Cells[2, 4];//2=row;4=column rn->Value2 = "leonigah";
Nigah M Manzoor
modified on Wednesday, July 23, 2008 8:13 AM
double xRatio = GetSystemMetrics(SM_CXSCREEN) / 800.00; double yRatio = GetSystemMetrics(SM_CYSCREEN) / 600.00; rect.left = long((rect.left/1.28)*xRatio); rect.top = long((rect.top/1.28)*yRatio); rect.bottom = long((rect.bottom/1.28)*yRatio); rect.right = long((rect.right/1.28)*xRatio);
Nigah M Manzoor
open or create usertype.dat file in a notepad and defined your keyword and save in folder where devenv.exe exist. C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\usertype.dat
Nigah M Manzoor
array<wchar_t>^ szArray = strPath->ToCharArray(); char buffer[50]={0}; int i = 0; for each(wchar_t ch in szArray) buffer[i++] = ch;
Nigah M Manzoor
for each(myStruct in myStructArray) { //code segments }
Nigah M Manzoor
void OnKeyPress(System::Windows::Forms::KeyPressEventArgs^ e)override { if((e->KeyChar=='.')) { if(this->Text->Contains(".")) e->Handled = true; } if(!(wchar_t::IsDigit(e->KeyChar) || wchar_t::IsControl(e->KeyChar))) e->Handled = true; }
Nigah M Manzoor
use GetDlgItem(IDC_STATIC1)->GetWindowRect(rect); ScreenToClient(&rect); instead of GetDlgItem(IDC_STATIC1)->GetClientRect(rect);
Nigah M Manzoor
BOOL CMyDlg::OnInitDialog() { CDialog::OnInitDialog(); CString str; CRect rect; GetDlgItem(IDC_STATIC1)->GetWindowText(str); int iLen = str.GetLength(); int iWidth = 8*iLen;//assume 8 pixel per character GetDlgItem(IDC_STATIC1)->GetWindowRect(rect); rect.right = iWidth; GetDlgItem(IDC_STATIC1)->MoveWindow(rect); return TRUE; }
Nigah M Manzoor
modified on Tuesday, July 1, 2008 7:58 AM
What is static Text Box?
Nigah M Manzoor
you have to use both event handler in OnKeyPress you know which key has been pressed and in OnTextChanged you can set the font and other things.
Nigah M Manzoor
create a public property in a form and by setting its property you can change the value //declaring property in CForm1 private: int abc; public : property int ABC { int get() { return abc; } void set(int value) { abc = value; } } // using property in CForm2 #include "Form1.h" CForm1^ frm = gcnew CForm1(); frm->ABC = 123;
Nigah M Manzoor
for float type variable : bool bFloat = false; int i = 0; for each (wchar_t ch in e->FormattedValue->ToString()->Trim()) { if(!wchar_t::IsDigit(ch)) { if(ch=='.' && i == 0) { bFloat = false; i++; } else bFloat = true; } }
Nigah M Manzoor
System::Void grid_CellValidating(System::Object^ sender, System::Windows::Forms::DataGridViewCellValidatingEventArgs^ e) { bool bInt = false; for each (wchar_t ch in e->FormattedValue->ToString()->Trim()) if(!wchar_t::IsDigit(ch)) bInt = true; if(e-->ColumnIndex==2)//Quantity { if(bInt) ;//DO else return; } }
Nigah M Manzoor
http://www.codeguru.com/cpp/cpp/cpp\_mfc/templates/article.php/c12721/ use above links to learn about crystal report.
Nigah M Manzoor
#include #include #include #pragma comment (lib, "ActiveDS.lib") #pragma comment (lib, "Adsiid.lib") void CSysInfoDlg::OnOK() { IADsContainer *pCont = NULL; CString str = "WinNT://DOMEN_NAME"; HRESULT hr = ADsGetObject(str.AllocSysString(), IID_IADsContainer, (void**) &pCont ); if(!SUCCEEDED(hr)) return; ULONG ulFetched = 0L; _variant_t var; _variant_t vChild; IEnumVARIANTPtr pEnum; ADsBuildEnumerator(pCont,&pEnum); while((SUCCEEDED(ADsEnumerateNext(pEnum, 1, &vChild, &ulFetched)) && ulFetched==1)) { IADsUser* pADs = NULL; hr = V_DISPATCH(&vChild)->QueryInterface(IID_IADsUser, (void**)&pADs); if(hr!=S_OK) break; DATE din = 0; pADs->get_LastLogin(&din); COleDateTime d(din); CString strIn = d.Format("%d-%m-%Y %H:%M"); DATE dout = 0; pADs->get_LastLogoff(&dout); COleDateTime d1(dout); CString strOut = d1.Format("%d-%m-%Y %H:%M"); BSTR bstrName; pADs->get_Name(&bstrName); CString strName = bstrName; SysFreeString(bstrName); pADs->Release(); pADs = NULL; MessageBox(strIn+"=="+strOut, strName); } if(pCont) pCont->Release(); }
Nigah M Manzoor
thanx, its working
Nigah M Manzoor
thanx,
Nigah M Manzoor
How to get Windows user's Login and Logout time?
Nigah M Manzoor