You can certainly use any cin/cout in ms c++, .. u have to include iostream.
kamalesh
You can certainly use any cin/cout in ms c++, .. u have to include iostream.
kamalesh
I hope this little sample code will help you if you want to select the folder, void CFolderSelectionDlg::OnBrowseClick() { BROWSEINFO brwsInfo; ZeroMemory(&brwsInfo,sizeof(BROWSEINFO)); int iImage = 0; char szFolderPath[MAX_PATH]; char szTitle[255]; memset(szFolderPath,'\0',sizeof(szFolderPath)); memset(szTitle,'\0',sizeof(szTitle)); brwsInfo.hwndOwner = GetSafeHwnd(); brwsInfo.iImage = iImage; brwsInfo.lpfn = NULL; brwsInfo.pidlRoot = NULL; brwsInfo.pszDisplayName = szFolderPath; brwsInfo.lpszTitle = szTitle; //InitCommonControls(); ITEMIDLIST *ptrItemList = SHBrowseForFolder(&brwsInfo); if(ptrItemList != NULL) m_strFolderPath = szFolderPath; UpdateData(FALSE); } this is the simplest. if you want all advanced functionality, you should inherit yoour custom fileDialog class. please go thourh the MSDN.you have to write your version of virtual void OnFolderChange(); virtual BOOL OnFileNameOK(); best of luck...
kamalesh
DWORD dwFileAttrib = 0; dwFileAttrib = GetFileAttributes(pathof Directory); if(dwFileAttrib == -1 || (dwFileAttrib & FILE_ATTRIBUTE_DIRECTORY) == 0) { AfxMessageBox("Directory path not exist"); }
kamalesh
sorry for the typing mistake,... i neead modal, but it's creating modeless... .
kamalesh
hi all, am getting a stange problem. from a call back function, am calling a MODELESS dialog,(when timeout reached for my dialog), but it's creating as a modal dialog... it's not my requirement. i've develop a sample,i think, it's created on a different thread than main thread. (may be.. not sure.).... please provide any commentsa nad solution.. please... :):confused: my code:(design form not included) using System; using System.Collections.Generic; using System.Diagnostics; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Threading; namespace TimeoutWindow { public partial class TimeoutForm : Form { private System.Threading.Timer m_Timer = null; private const int WH_KEYBOARD = 2; private const int WH_MOUSE = 7; private LowLevelKeyboardProc _procKey = KeyHookCallback; private LowLevelKeyboardProc _prockMouse = MouseHookCallBack; private static IntPtr _hookIDKey = IntPtr.Zero; private static IntPtr _hookIDMouse = IntPtr.Zero; private static UInt32 m_LastHitTime = 0; private System.Threading.TimerCallback timerCallBack = null; private AutoResetEvent autoEvent = null; private Form2 dlg; private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam); public TimeoutForm() { InitializeComponent(); _hookIDKey = SetWindowsHookEx(WH_KEYBOARD,_procKey,(IntPtr)0,(uint)AppDomain.GetCurrentThreadId()); _hookIDMouse = SetWindowsHookEx(WH_MOUSE,_procKey,(IntPtr)0,(uint)AppDomain.GetCurrentThreadId()); timerCallBack = new System.Threading.TimerCallback(this.CheckTimeout); autoEvent = new AutoResetEvent(false); m_LastHitTime = GetTickCount(); m_Timer = new System.Threading.Timer(timerCallBack, autoEvent, 20000, 20000); } private void OnTryLogin(object sender, EventArgs e) { MessageBox.Show("HI"); Form2 dlg = new Form2(); dlg.ShowDialog(); } public void CheckTimeout(Object stateInfo) { autoEvent = (AutoResetEvent)stateInfo; UInt32 curTime = GetTickCount(); if (curTime - m_LastHitTime > 2000) { this.m_Timer.Dispose(); try {
Hi all, Currently am working in a project, where in my application there is a window form, holding several pages(using WPF).now i've to implement session timeout functionality in my application using window hook for keyboard and mouse. i've a implemented a timer(System.Threading)TimerCallback, which periodically examine, whether, any key board message or mouse message occure ONLY ON MY APPLICATION. this means, minimizing my application form, i can play computer game, but after certain period my application can throw timeout session. now the problem is, delegate(by which i'm calling window hook function whenever key or mouse pressed) is firing event even if my function is minimized. (i know this will fire), but the only requirement is how i manipulate these messages (key and mouse messages)only haapen to my application window. i don't know how to do this.. please help please go through these urls, as i'm trying to develop window hook, by help of these..... here he has used WH_KEYBOARD_LL Hook which is global 1. "http://blogs.msdn.com/toub/archive/2006/05/03/589423.aspx" 2. "http://blogs.msdn.com/toub/archive/2006/05/03/589468.aspx" Please please help...... :^) -- modified at 18:14 Saturday 8th September, 2007
kamalesh
Thanks for this nice and beutiful code. Thanks to all....All are helpfuls. Thanks again.
kamalesh
Hi All, Currently I'm developing a tool, for that purpose i have to know all other processes running on the computer and achieve the handle of specified process.There are some functions in VB and but i need to write in MFC only... How can get it? bye kamalesh
kamalesh
Am trying to oepn a text file( not empty file). Want to delete a specified portion of the file ( around 10 chars from the middle of the file). how can i do it? i've already calculated start position and end position. but don't know how to delete that part and again write that part. Thanks in advance
kamalesh
In my application i've to move a specified folder to another location. suppose currently i've folder "VisualBasic"in "C:\programs\kamalesh\temp\VisualBasic" .Now I want to move this folder to new location like this "C:\programs\kamalesh". this movement should be done by coding... as by coding i'm trying to make a folder in temporary location and after fulfilling my intention i've to move that in exact location... now the question is how can i do this by mfc coding.... thanks in advance.
kamalesh
Am using 2004 MSDN. there is no such kind of function(CStdioFile::GetString()).
kamalesh
sorry i was at hurry.... I want to read a line from a file which consist number of lines.In mfc library there is no function for "fgets"( am opening this file "CFile::Open(.....) function,with sharedeny access flagcheck).If any one can give me the hint to how to write this generic functiopnality using mfc, i'll be gratefull.
kamalesh
I want to read a line from a file which consist number of lines.In mfc library there is no function for "fgets"( am opening this file "CFile::Open(.....) function,with sharedeny access flagcheck).If any one can give me the hint to how to write this generic functiopnality using mfc, i'll be gratefull.
kamalesh
i just want "secure deletion"... if i just delete , the data used in the file is very much recoverable, untill the same space of the hard disc is overwritten( as the space is holding the data)... that's y i need to change every char in the file by a random generated numbers
kamalesh
Hi all, I need to open a file using Win 32(MFC API).. read each line from it, and after reading all the line i've to replace each char in the file with a random number.. after that i've to delete that file.... It's very urgent..i'll be very grateful if anyone provide the solution.... bye
kamalesh
I've to create the "find string option in a particular file" with key board enable "Ctrl+F".how can i do that?
kamalesh
I'm in trying to run a application(vc++)....the exe generated is absolutely running fine in DEBUG version...but when ever i try to rrun in Release version, it's not working properly...this is really a strange problem.... Cud anybody tell me the remedy of this problem? kamalesh
&TP->TR.Account[1] returns the string literal.so be sure that it's not making any problem. nd i used SetItemText as well as the SetItem both function. Good Day kamalesh
Hi i've strange problem.i've 4 columns Account,date,amount,address in a Clist Control. //a breif abt my project in my project am trying to slect a file by browsing (i used cfiledialog). & then pressing the button 'showbutton' i want to see all the documents(i.e.account,date,amount,address) of that file.this file is actually a list of several transaction......... now in this project i didn't use classwizard, all the message mapping,dialog creation i've done mannually............... //the problem now, the problem is, while am trynig to insert items in the r8 column, only the 1st column is being populated , not the others....in the insertion column CString strItem; LVITEM lvi; lvi.mask = LVIF_TEXT; //Account no... strItem.Format(_T(&TP->TR.Account[1])); lvi.iSubItem = 0; lvi.pszText = (LPTSTR)(LPCTSTR)(strItem); m_cListCtrl.InsertItem( &lvi); //Expirary Date strItem.Format(_T(&TP->TR.ExpDate[1])); lvi.iSubItem = 1; lvi.pszText = (LPTSTR)(LPCTSTR)( strItem); m_cListCtrl.InsertItem( &lvi); nd this way only putting "lvi.iSubItem=2,3...4" Don't get confused with TP,TR...these r my project variables for other issues. using that above code.. am getting only 1st column.... waiting for quick reply.....A GOOD DAY to all. kamalesh
I need to use a ccontrol list to show data, after pressing button 'showdata'.....in a old project(DIALOG BASED).....the problem is that..... in this project i can't use class wizard. kamalesh