|
How do I get minor errors in OLE DB Provider. Like if I get E_FAIL, how wd I get the minor error associated with it?
|
|
|
|
|
I belive E_FAIL is total failure of the operation without specific reason.
I have lost more blood shaving than on the battlefield - Adolf Hitler
|
|
|
|
|
no, E_FAIL does give minor error info. Every OLE DB Error gives the minor error info as well. I don't know the way to get this error. Documentation is too vague to understand.
|
|
|
|
|
Could someone tell me how to get a file's date time stamp? I am using VC++ 2002. Is there a way to get this using streams? or do I have to use MFC?
Thanks in advance
|
|
|
|
|
ByNar wrote:
Could someone tell me how to get a file's date time stamp?
GetFileTime() comes to mind.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
I have a virtual nic adapter that I need to recognize in run time to find the ip it has.
For windows XP the function "GetAdaptersInfo" does the trick and returns the right name in the Description field of the IP_ADAPTER_INFO structure.
For window 2000 "GetAdaptersInfo" returns a different Description field in the IP_ADAPTER_INFO structure( it returns "virtual adapter").
For windows NT the function "GetAdaptersInfo" is not supported at all.
Is there any way to find out all the existing adapters and their information in windows NT?
Is there any way to get the "friendly name" of the adapter from the windows api?(that is the name that is returned by ipconfig /all).
Please help.
Thanks.
avivhal
|
|
|
|
|
There are applications of Microsoft on which text is present like WordPad, notepad, explorer e.t.c.
Suppose if i have a window of WordPad opened. Some text is written in the client area of this window. Now i want my application to "grab" all the text written in the client area of this window of WordPad. Is it possible?? If yes, then can you suggest me some method ???
|
|
|
|
|
With Wordpad or Notepad, not that I know of. You can, however, do what you require with Word. Search MSDN for Word (or Office) Automation.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hello
I need working example of a Modeless Dialog in DLL using MFC and LoadLibrary.
(in this code fragment I left out error checking.)
What I have done is
in MainEXEView.cpp
void CMainEXEView::OnButton1()
{
HandleToDLL= LoadLibrary("modelessDLL.dll");
InterfaceDLLPointer = (DLLInterfaceMethod) (GetProcAddress(HandleToDLL,"CreateMyDlg"));
TheHwnd = GetDlgItem(IDC_HOLDDLL)->m_hWnd;
InterfaceDLLPointer(TheHwnd);}
}
in the DLL.cpp ( statically linked DLL)
dlldlg *dlg;
__declspec (dllexport) __stdcall CreateMyDlg(HWND pParentWnd)
{
CRect rc;
AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Need this to switch to local module state.
CWnd * Parent = CWnd::FromHandle(pParentWnd);
dlg = new dlldlg();
dlg->Create(dlldlg::IDD, Parent);
dlg->ShowWindow(SW_SHOWNORMAL);
Parent ->GetWindowRect(rc);
Parent ->ScreenToClient(&rc);
dlg->MoveWindow(rc);
return dlg->m_hWnd;
}
The dlldlg has some buttons for testing.
At this point, the DLL dialog appears correctly on the screen. The problem is not that the keyboard events fail, as reported elsewhere.
Rather, the buttons do not work and the program hangs. So....
I did the following:
BOOL CMainEXEView::PreTranslateMessage(MSG* pMsg)
{
BOOL AnyMessages;
AnyMessages=CFormView::PreTranslateMessage(pMsg);
if (!AnyMessages)
{
if (Ready)
{
if (InterfaceDLLPointer_Messages!=NULL)
AnyMessages= InterfaceDLLPointer_Messages(pMsg);
}
}
return AnyMessages;
}
where InterfaceDLLPointer_Messages was another entry point into the DLL, called HandleMessages
DLL.cpp
__declspec (dllexport) BOOL __stdcall HandleMessages(MSG *pMsg)
{
// return theApp.PreTranslateMessage( pMsg); // this did not help
// return dlg->PreTranslateMessage( pMsg); // this crashes
AFX_MANAGE_STATE(AfxGetStaticModuleState());
TRY
{
return AfxGetThread()->PreTranslateMessage(pMsg);
}
END_TRY
return FALSE;
}
The variations in this method did not help.
I can trace the flow from the main app via PreTranslateMessage into the DLL.
Clicking on any button on the modeless dialog hangs the code.
I would welcome any comments but best of all a working sample.
Thanks to everyone.
Paul
|
|
|
|
|
You have used AFX_MANAGE_STATE(AfxGetStaticModuleState()); to switch to dlls context, so when the messages are translated in the main thread the sate is not correct. May be this is crashing, In Debug mode you should get an assert.
P.R.A.K.A.S.H
|
|
|
|
|
Thank you for your suggestion.
It got me thinking about the dialog style. In the main exe where I have a number of modeless dialogs, I set the dialog style to include control. This has the effect in the main exe of allowing the tab key to move between the controls on any modeless dialog. When the last control is exited (loses focus), the dialog style causes the tab key to move out of the current modeless dialog and enter the next modeless dialog.
But in the case of the DLL, this was not correct. The solution turned out to be to clear the dialog style settings and leave only the Visible checked.
Once I solved this small hitch (like two days later), I then discovered that while the tab key works properly inside the modeless Dialog created by the DLL, the effect of leaving the DLL was disabled. This was because the control style was not set.
In the end, I settled for raising an event (i.e. callback) on one of the controls in the DLL that changed the focus to a control in the main app.
in the following example, MyModeless was the hWnd returned from the DLL for the dialog
BOOL CMainEXEApp::PreTranslateMessage(MSG* pMsg)
{
if (TheView->MyModeless!=NULL)
{
if (IsDialogMessage(TheView->MyModeless, pMsg))
return TRUE;
}
return CWinApp::PreTranslateMessage(pMsg);
}
void CMainEXEApp::ChangeTabOrder( void * pPointer)
{
if (pPointer ==NULL)
{
SetFocus(TheView->GetDlgItem(IDC_BUTTON2)->m_hWnd);
}
}
Thanks for the response
paul
|
|
|
|
|
Hi,
I would like to lead execution of my program with keyboard. I need function which will wait for keyboard input and would not spent any processor time.
Is it possible to use GetMessage() and message queues (window based aplications) in console application?
Tomaz Rotovnik
|
|
|
|
|
|
|
hello all, im new in c++ and i need help doing something like this:
i like to dance danci
dance
danci
i
like
to
i need to sort it using pointers and without using strcmp(string.h library).
any help please.(c++ console mode).
edited***
thanks guys for answer but the problem is that is for a LAB and i cant use any help of string or algorithm libraries, sorry. the way i want is old style programming.
a for to compare strings(arrays), something like that.
|
|
|
|
|
Hi,
try CString class ( you choose console->With MFC support).
With Regards,
R.Selvam
|
|
|
|
|
This is one way...
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
// Initialise array
string source[] = {"i", "like", "to", "dance", "danci"};
// Sort it
int count = sizeof(source) / sizeof(source[0]);
sort(source, source + count);
// Print it
copy(source, source + count, // source
ostream_iterator<string>(cout, "\n")); // destination
cout << endl;
return 0;
}
Kevin
|
|
|
|
|
This will also work if you replace "string" with "char*".
Kevin
|
|
|
|
|
hollowsoft wrote:
i need to sort it using pointers and without using strcmp(string.h library).
You can always make your own:
int __cdecl strcmp( const char * src, const char * dst )
{
int ret = 0 ;
while (! (ret = *(unsigned char *) src - *(unsigned char *) dst) && *dst)
++src, ++dst;
if (ret < 0)
ret = -1 ;
else if (ret > 0)
ret = 1 ;
return (ret);
}
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
I am trying to reposition glyphs through Uniscribe. http://www.codeguru.com/forum/showthread.php?s=&threadid=284771 shows a diagram of what I am trying to achieve. The reason is also explained below.
Uniscribe’s ScriptTextOut function has a GOFFSET Structure (.du and .dv), apparently an ‘x,y Glyph offset’. In testing on both TrueType and OpenType fonts (Arial, Microsoft Sans Serif) this does not appear to modify the glyph position.
Q. Does anyone know how the GOFFSET feature works and whether it can offset vowel symbols?
There appears to be another helper technology associated with Uniscribe, Microsoft’s OpenType Layout Services (OTLS) which allows Glyph repositioning and substitution through access to the font’s GPOS and GSUB tables. However, the link http://www.microsoft.com/typography/developers/otls/ to OpenType Layout Service Library and Contact details no longer appear supported.
Q. Does anyone know how to obtain the OpenType Layout Service Library (OTLS)?
Q. Any other suggestions?
Why reposition glyphs?
I am trying to build a prototype for learning to read Arabic with the vowel symbols.
Arabic is difficult to learn to read. It is written from right-to-left and the letters can take as many as four forms. In addition, unlike European languages, beginners learning Arabic have to master reading letters and their accent symbol, representing vowels, stacked vertically two or three high. This combination of the letter and the associated vowel effectively form one syllable.
When Arabic text is displayed in Windows, the vowel and similar symbols are positioned to the end of the letter and not at identical heights. To make reading easier, I am trying to reposition these vowel symbols (glyph repositioning) so that these vowel symbols occur above or below the centre of the letter and at an equal height as illustrated in the example.
|
|
|
|
|
i use DirectX to get Video interface (Front surface) memory, size is 800x600x2 bytes.
when i try to get data from the memory, operating process is so slow (i.e. memcpy() function is 250 ms).
any one can give me some light in DirectX field to make it go faster?
thanks
includeh10
|
|
|
|
|
Is there a possibility to change fonts in MessageBox(...)
Please help
|
|
|
|
|
No use chaning the font of the messagebox , coz we have litter control over it and other complication may come into the picture, Instead go for custom messagebox, i think it goes by the name XMessageBox here in codeproject.
I have lost more blood shaving than on the battlefield - Adolf Hitler
|
|
|
|
|
as i understood critical is used to control the access of different threads over a resource.
I performed the following experiment.
defined a critical section structure.
initialiaed the critical section
I then in a functino called
Entercriticalsection(...); followed by again
Entercriticalsection(...);
I thought it should threadlock in the second call, but its not locking the thread. am i missing something ?
I have lost more blood shaving than on the battlefield - Adolf Hitler
|
|
|
|
|
The critical section is already owned by the calling thread so the second call will slip trough.
Try it from two different threads instead.
And you must have a matching LeaveCritcalSection() call for each EnterCritcalSection().
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|