|
CTeltikDlg* pmain=(CTeltikDlg*)GetParent(); pmain->GetDlgItemText(IDC_EDIT1,str);
// Use this code in the second dialog. Do not forget to include the header file for the first dialog
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
hi
thanx for replying me.
its working now
thank u very much.
|
|
|
|
|
Hi Aashish
i will u the answer but one thing which i want ot clear to u that we r not very far.
i'm from Delhi.can i get ur email id or cell no.so we can be a gud friend.becoz i like people of my field.
my person id is
amit_avesh@yahoo.co.in
now back to ur question
i'm not getting why r u not getting answer.i have defined in the OninDialog of the other class.
or tell me what u exactly want to do.
thanx
|
|
|
|
|
The most straightforward way is to store the value in your edit control variable of your second dialog. e.g.
Cdlgbox dlg;
dlg.m_sEditControlValue = str;
dlg.DoModal(); And in OnInitDialog() method of your second dialog, you have to set the value into the edit box by calling SetWindowText(...) or another easy way is just to call UpdateData(FALSE).
|
|
|
|
|
Hi,
I am trying to make a custom treeview in C++ to display the shell's namespace.
It works great for all folders except physical drives and remote or network folders. I can't get the correct icons for these folders. I am using the following code snippet to load the icons for the specified folder: (Only need to obtain the icon index)
//Retrieve the icon closed for the folder
if(SHGetFileInfo((LPCSTR)lpItemIDList1,0,&fileInfo,sizeof(SHFILEINFO),SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_SYSICONINDEX)==NULL)
{
lpMalloc->Free(lpItemIDList1);
lpEnumIDList->Release();
if(lpSubFolder)
{
lpSubFolder->Release();
}
return FALSE;
}
lpTreeNode->ImageIndex=fileInfo.iIcon;
//Retrieve the icon opened for the folder
if(SHGetFileInfo((LPCSTR)lpItemIDList1,0,&fileInfo,sizeof(SHFILEINFO),SHGFI_OPENICON|SHGFI_PIDL|SHGFI_SMALLICON|SHGFI_SYSICONINDEX)==NULL)
{
lpMalloc->Free(lpItemIDList1);
lpEnumIDList->Release();
if(lpSubFolder)
{
lpSubFolder->Release();
}
return FALSE;
}
lpTreeNode->SelectedIndex=fileInfo.iIcon;
The pointer lpItemIDList1 points to a piddle that contains the absolute location of the specified folder. (Relative to the root aka desktop folder)
I am only trying to display folders.
Thanks
|
|
|
|
|
I am trying to read from a text file and output the data to a CSV file. Can anybody help me with this please?
Cheers Phil
|
|
|
|
|
Are you using MFC? Then go though the class CStdioFile, which gives easy functions to read and write text files.
|
|
|
|
|
I'm using Visual C++. Would it work in the same way?
|
|
|
|
|
hi all plz help me
i make a SDI application i dont add any code to it
now i add OncreateClient function in the mainframe class and add code as
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
CSplitterWnd m_wndsplitter;
return m_wndsplitter.Create(this,2,2,CSize(10,10),pContext,WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|SPLS_DYNAMIC_SPLIT,AFX_IDW_PANE_FIRST);
//return CFrameWnd::OnCreateClient(lpcs, pContext);
}
but when i run this no split window is opened
i try by adding an item split in the IDR_MAINFRAME menu but when i run program this split in menu is disabled
but i want to enable it and when i click it a splitter appear to split the window
plz tell me
Ashish Dogra
MCA
Noida
|
|
|
|
|
What's that return written in the mid of your code.
Have you derived classes from CView ?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
yes sir i derived it from CView but nothing happen
Ashish Dogra
MCA
Noida
|
|
|
|
|
Listen Ashish.
What I told you yesterday was that you would need to derive classes from CView and then use CreateStatic(.....)
For example I am providing a snippet of code for splitting a window in shape of
////////////////////////////////
-------------||-----------------
------1-View-||--------2 View--
-------------||-----------------
-------------||-------------------
=================================
3 View
/////////////////////////////////
m_wndSplitter1.CreateStatic(this,2,1);
m_wndSplitter1.CreateView(1,0,RUNTIME_CLASS(COneView),CSize(200,200),pContext);
m_wndSplitter2.CreateStatic(&m_wndSplitter1,1,2);
m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CTreeDeriv),CSize(200,200),pContext);
m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS(CTwoView),CSize(200,400),pContext);
return TRUE;
///////////////////////////////////
here COneView and CTwoView were the classes that were derived from CView.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 5:32 Tuesday 4th July, 2006
|
|
|
|
|
sir this code does not work as i run application it doesnot show window and it show error message
Ashish Dogra
MCA
Noida
|
|
|
|
|
What error message is it showing?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
it show send error or dont send error type message
Ashish Dogra
MCA
Noida
|
|
|
|
|
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
int n_id = AFX_IDW_PANE_FIRST;
if (!m_splitwnd.CreateStatic(this, 1, 2, WS_CHILD|WS_VISIBLE|WS_BORDER, n_id))
{
return FALSE;
}
if (!m_splitwnd.CreateView(0, 0, RUNTIME_CLASS(CView1),CSize(0, 0), pContext) ||
!m_splitwnd.CreateView(0, 1, RUNTIME_CLASS(CView2), CSize(0, 0), pContext))
{
m_splitwnd.DestroyWindow();
return FALSE;
}
m_splitwnd.SetColumnInfo(0, 300, 50);
return TRUE;
}
My Code is runing. You can try.
// with CView1/2 your View
If one of view is CFormView, you check setting Dialog of FormView, Style is Child.
.: Your success is also mine :.
|
|
|
|
|
sorry sir but
sir here it does not work
plz tell me iwa nt to add a menu and when i click on that splitter appear on window
tell me plz
Ashish Dogra
MCA
Noida
|
|
|
|
|
i want to know how to work with Copyfile method
|
|
|
|
|
|
CopyFile(existfile,newfile,if true overwrite file else none);
whitesky
|
|
|
|
|
I have seen how to create ActiveX from Dialog frame as
http://www.codeguru.com/Cpp/COM-Tech/activex/controls/article.php/c2615/
Now, i am finding the way to create ActivX like SDI Application. I seen a sample in
http://www.microsoft.com/mind/0497/mfc.asp
but it not a pop-up SDI window like .exe.
How to create it?
|
|
|
|
|
I use SetWindowRgn button to circular button, but when button redraw, the button rectangle background is show. Why?
Thanks.
|
|
|
|
|
|
Hi guys,
I was wondering how someone would find the Ordinal of an imported function? I am using an API hook function which is below:
PVOID HookImportedFunction(const char *Dll, const char *FuncName, int Ordinal, void *Function)
{
DWORD oldProtect;
void *PrevValue=0;
DWORD image_base = (DWORD)GetModuleHandle(NULL);
IMAGE_DOS_HEADER *idh = (IMAGE_DOS_HEADER *)image_base;
IMAGE_FILE_HEADER *ifh = (IMAGE_FILE_HEADER *)(image_base +
idh->e_lfanew + sizeof(DWORD));
IMAGE_OPTIONAL_HEADER *ioh = (IMAGE_OPTIONAL_HEADER *)((DWORD)(ifh) +
sizeof(IMAGE_FILE_HEADER));
IMAGE_IMPORT_DESCRIPTOR *iid = (IMAGE_IMPORT_DESCRIPTOR *)(image_base +
ioh->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
VirtualProtect((LPVOID)(image_base +
ioh->DataDirectory[IMAGE_DIRECTORY_ENTRY_IAT].VirtualAddress),
ioh->DataDirectory[IMAGE_DIRECTORY_ENTRY_IAT].Size, PAGE_READWRITE,
&oldProtect);
while(iid->Name)
{
if(stricmp(Dll, (char *)(image_base + iid->Name)) == 0)
{
IMAGE_THUNK_DATA * pThunk = (IMAGE_THUNK_DATA *)
((DWORD)iid->OriginalFirstThunk + image_base);
IMAGE_THUNK_DATA * pThunk2 = (IMAGE_THUNK_DATA *)
((DWORD)iid->FirstThunk + image_base);
while(pThunk->u1.AddressOfData)
{
char * name = 0;
int ordinal;
if(pThunk->u1.Ordinal & 0x80000000)
ordinal = pThunk->u1.Ordinal & 0xffff;
else
{
IMAGE_IMPORT_BY_NAME * pname = (IMAGE_IMPORT_BY_NAME *)
((DWORD)pThunk->u1.AddressOfData + image_base);
ordinal = pname->Hint;
name = (char *)pname->Name;
}
if(name != 0 && FuncName && strcmp(name, FuncName) == 0)
{
PrevValue = (void*)pThunk2->u1.Function;
#if _MFC_VER == 0x0600
pThunk2->u1.Function = (DWORD*)Function;
#else
pThunk2->u1.Function = (DWORD)Function;
#endif
}
else if(ordinal == Ordinal)
{
PrevValue = (void*)pThunk2->u1.Function;
#if _MFC_VER == 0x0600
pThunk2->u1.Function = (DWORD*)Function;
#else
pThunk2->u1.Function = (DWORD)Function;
#endif
}
pThunk++;
pThunk2++;
}
}
iid++;
}
return PrevValue;
}
However I do not know how to get the Ordinal of a windows API function, say CreateFile or WriteProcessMemory . I know an ordinal of the function MessageBoxA is 476, but I cant find the ordinals of these functions.
Would anyone know how you would find the ordinals?
Thanks,
Robbie
|
|
|
|
|
Maybe the following sample function will give you some ideas?
It returns the ordinal number having the handle of the DLL (from LoadLibrary ) and the address of the exported function (from GetProcAddress ):
WORD getFunctionOrdinal( HMODULE hModule, FARPROC pFunction)
{
if( hModule == 000 || pFunction == 000) return 0;
ULONG export_dir_size;
PIMAGE_EXPORT_DIRECTORY pExportDir =
(PIMAGE_EXPORT_DIRECTORY)ImageDirectoryEntryToData(
hModule,
TRUE,
IMAGE_DIRECTORY_ENTRY_EXPORT,
&export_dir_size
);
if( pExportDir == 000)
{
return 0;
}
LPCSTR const charAddress = (LPCSTR)hModule;
WORD const base = (WORD)pExportDir->Base;
PDWORD const pFunctions = (PDWORD)(charAddress + pExportDir->AddressOfFunctions);
PWORD const pOrdinals = (PWORD)(charAddress + pExportDir->AddressOfNameOrdinals);
DWORD const numberOfFunctions = pExportDir->NumberOfFunctions;
DWORD const numberOfNames = pExportDir->NumberOfNames;
for( DWORD i = 0; i < numberOfFunctions; ++i)
{
FARPROC const fp = (FARPROC)(charAddress + pFunctions[i]);
if( fp == pFunction)
{
return (WORD)(i + base);
}
}
return 0;
}
I hope this helps.
|
|
|
|
|