|
|
Thanks for the link, but the article is for a very outdated version of DirectX.
I actually created my own solution, and it was very simple. I used a TriangleFan arranged in such a way that it creates something like a pie chart. This made my other problem of creating a fade effect even easier to solve.
|
|
|
|
|
Hi all,
I am currently trying to get our application working on Vista. We currently build a dynamic pdf file and attach it to a Outlook message through Simple Mapi. This has worked until now. When I call MapiLogin, it returns an error code of 1924235005. This number changes each time it is run, but it is about the same. This is followed by the error message from Outlook, "An error occurred while attempting to open the Windows Address Book. Unable to find the WAB.DLL MAPI 1.0 [00000220]". This only occurs with Outlook 2000. More recent versions of Outlook do work.
Has anyone else run into this?
Any help would be greatly appreciated.
Thanks in advance.
Greg
|
|
|
|
|
Hi,
I have an Atl Component with an Interface EFCMyForm .(ATL Simple Object -- VS2005)
And a Dialog class CMydialog with ActiveX controls Placed on it. using right Click on Dialog and Insert ActiveX Control
In One of thw Exposed Method I am creating the dialog box CMyDialog
CMydialog g_myDlg;
STDMETHODIMP CEFCMyForm::Create()
{
#ifdef _AFXDLL
AFX_MANAGE_STATE(AfxGetStaticModuleState())
#endif
g_myDlg.Create(IDD_MY_DLG);
} using CDialog:: Create().
If I take a Global variable I don't have any problem but if I take mydialog obj as member variable as shown below...
CMydialog m_myDlg;
STDMETHODIMP CEFCMyForm::Create()
{
#ifdef _AFXDLL
AFX_MANAGE_STATE(AfxGetStaticModuleState())
#endif
m_myDlg.Create(IDD_MY_DLG);
} using CDialog:: Create().
then the ActiveX Controls which are placed on the Dialog are not being Shown.
To resolve this If I try to Dyanamically create the ActiveX controls in
CMyDialog::OninitDialog()
{
-----Using Create Control------
CLSID clsid;
HRESULT hr1 = CLSIDFromProgID(OLESTR("EsdGraphCtrl.EsdGraphControl.3.0"),&clsid) ;
if (FAILED(hr1))
{
return FALSE;
}
BOOL blnSuccess;
CRect rc;
rc.left=0;
rc.top=0;
rc.right= 100;
rc.bottom =100;
blnSuccess = m_AxGraphControl.CreateControl(clsid,_T("Graph"),WS_VISIBLE|WS_CHILD,rc,this,100,0,0,0);
if (!blnSuccess)
{
return FALSE;
}
}
Any Suggestions would be helpful
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
hi there genius!!!
I´m actualy programming a routine which needs to detect if the ethernet interface in my system is up or down.
To be more specific; what i exactly need is to know if exist some way to listen to ethernet port and ALERT ME when a ethernet cable/wire is pluged in the PC.
I will be a happy man if u can help me in any of these questions?!
THANX IN ADVANCE
MARCOS!!!
|
|
|
|
|
Have you tried the ISensNetwork interface?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I am very much stuck in an urgent assignment and in need of help as i have committed a Excel like Grid to a client.
My requirement is to have a Grid just like Excel and to take input from user using only Win API and GDI etc (No MFC allowed). I have already created the Grid but the problem is how to show the cursor in the rectangular boxes in grid and to take input form user?
One option is to use 'Text Box' control already provided in WinAPI but the problem is that its width would be fixed and only a part of text written in it is viewable to user depending on its width.
What i want is the input functionality just like MS Excel in which the input text is automatically extended to next cell when it exceeds the limit of a cell.
I would really appreciate if any one can provide me with the source code of such a control or could help me out in this difficult task?
Thanks and Regards,
Zeeshan Malik
zeemalik78@yahoo.com
To do what can be done is Intelligence and To do what should be done is Genious
|
|
|
|
|
It's relatively simple to use the caret APIs and catch keystroke messages for simple text
input. Maybe you have some of the code already to use arrow keys to navigate the grid.
Here's an example of a modal text edit loop (with probably more keys checked than you need for
single-line editing). The CaretUp()/CaretDown()/CaretLeft()/CaretRight()/MoveCaret() set the
caret position based on a row/column and the font size (fixed pitch fonts make this easy):
MSG LoopMsg;
bool fRedraw = false;
bool fEditing = true;
while (fEditing)
{
if (::PeekMessage(&LoopMsg,0,0,0,PM_REMOVE))
{
::TranslateMessage(&LoopMsg);
::DispatchMessage(&LoopMsg);
if (LoopMsg.message == WM_LBUTTONDOWN)
{
}
if (WM_KEYDOWN == LoopMsg.message)
{
switch (LoopMsg.wParam)
{
case VK_RETURN:
fEditing = false;
break;
case VK_HOME:
MoveCaret(view, 0, nCurRow);
break;
case VK_END:
MoveCaret(view, nCharColumns, nCurRow);
break;
case VK_PRIOR:
MoveCaret(view, nCurColumn, 0);
break;
case VK_NEXT:
MoveCaret(view, nCurColumn, nCharRows - 1);
break;
case VK_LEFT:
CaretLeft(view);
break;
case VK_RIGHT:
CaretRight(view);
break;
case VK_UP:
CaretUp(view);
break;
case VK_DOWN:
CaretDown(view);
break;
case VK_DELETE:
DeleteChar();
fRedraw = true;
break;
case VK_BACK:
if (nInsertOffset > 0)
{
CaretLeft(view);
DeleteChar();
fRedraw = true;
}
break;
}
}
else if (WM_CHAR == LoopMsg.message)
{
switch (LoopMsg.wParam)
{
case 0x08:
break;
case 0x09:
break;
case 0x0D:
break;
case 0x0A:
break;
case 0x1B:
fEditing = false;
break;
default:
InsertChar((TCHAR)LoopMsg.wParam);
fRedraw = true;
break;
}
}
else if (WM_SETFOCUS == LoopMsg.message)
{
::MessageBeep(-1);
}
else if (WM_KILLFOCUS == LoopMsg.message)
{
fEditing = false;
}
if (fRedraw)
{
fRedraw = false;
HideCaret(view);
ShowCaret(view);
}
}
}
|
|
|
|
|
Hi for all
I'm trying to pass some data between 2 windows. This is the class that I pass between my 2 windows. It's just a single class with a based pointer:
<br />
<br />
#ifndef TESTE_H<br />
#define TESTE_H <br />
#include <windows.h> <br />
void * vValue; <br />
class Teste <br />
{ <br />
public: <br />
Teste(); <br />
~Teste(); <br />
void SetMsg(char * cMsg);<br />
void ExibeMsg(); <br />
Teste __based(vValue) * Single;<br />
private: <br />
char * m_cMsg;<br />
char * m_cClassName;<br />
}; <br />
Teste::Teste()<br />
{<br />
if(m_cClassName == 0)m_cClassName = "Classe Teste";<br />
}<br />
Teste::~Teste(){}<br />
void Teste::SetMsg(char * cMsg)<br />
{<br />
m_cMsg = cMsg;<br />
}<br />
void Teste::ExibeMsg()<br />
{<br />
if(m_cMsg != NULL)MessageBox(NULL, m_cMsg, "msg", MB_OK);}<br />
#endif TESTE_H<br />
This is the code that sends the data and handles the data:
<br />
<br />
case WM_COPYDATA:<br />
{<br />
COPYDATASTRUCT * dataReceived = (COPYDATASTRUCT*)lParam; <br />
Teste * tempTeste = (Teste*)dataReceived->lpData; <br />
Teste * ttt = tempTeste->Single; <br />
char cResult[256] = {0}; <br />
int nCount = 0; <br />
if(ttt != NULL)<br />
{<br />
MessageBox(NULL, "exibindo msg janela 1", "", MB_OK); <br />
ttt->ExibeMsg();<br />
}<br />
break;<br />
}<br />
<br />
case WM_COMMAND:<br />
{ <br />
switch(LOWORD(wParam))<br />
{<br />
case IDC_BUTTON1:<br />
{<br />
char cLength[20], cSize[5]; <br />
if(HIWORD(wParam) == BN_CLICKED)<br />
{<br />
if(GetDlgItemText(hwnd, IDC_EDIT1, cLength, 20) != 0)<br />
{<br />
Teste teste1; <br />
teste1.SetMsg("aaa");<br />
vValue = (void*)&teste1;<br />
COPYDATASTRUCT dataToSend;<br />
dataToSend.cbData= sizeof(void*);<br />
dataToSend.lpData = vValue;<br />
dataToSend.dwData = 0;<br />
HWND tempHwnd = FindWindow(NULL, "Janela 2");<br />
if(tempHwnd != NULL)<br />
{<br />
SendMessage(tempHwnd, WM_COPYDATA, wParam, (LPARAM)&dataToSend);<br />
}<br />
}<br />
else<br />
{<br />
MessageBox(NULL, "EditBox with no text", "info", MB_OK);<br />
}<br />
}<br />
break;<br />
}<br />
}<br />
break;<br />
}<br />
The problem is, when I call the ExibeMsg() func with my object in the WM_COPYDATA message, the application crashes. What I'm doing wrong? Anyone can suggest me a solution?
Thanks for help
|
|
|
|
|
The Memory that you point to, is only valid in the function because it goes out of scope. It is better with static memory or allocated with GlobalAlloc.
Attention: I think with most above written you 'may' run into trouble on the new MS Windows Vista.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: allocated with GlobalAlloc
why don't you just new it ?
|
|
|
|
|
if it is in the same app/process it is OK, but he didnt say that.
In the same app I would use a global (memory) object.
Greetings from Germany
|
|
|
|
|
but GlobalAlloc() is not portable...
|
|
|
|
|
In a site(www.flounder.com), I read this:
"The problem of storing pointers is a little bit misleading. You must not store pointers in the structure you pass, even if they are pointers into the same area you are passing, because when the message is received the recipient has no control over where it is placed, and the pointers are likely to be nonsense. Obviously, you can't store pointers to other areas of your own memory because they will be completely nonsensical in the receiving process; they will be interpreted in its own address space.
But the misleading aspect is that if you have a structure which is entirely self-contained in the data area you are sending over (that is, every pointer refers to another structure in the area you are sending), then you can use based pointers to encode them. Based pointers are actually relative offsets measured from a specific starting point (such as the start of the area being transmitted), and are automatically adjusted by the recipient (as long as you set up the correct base value) so they are valid pointers."
So I have a based pointer in my class that is the same type of the class. This pointer must have to arrive(I think) to the other window safetly.
toxcct, if I use new I lose the control over the pointer in the other window.
|
|
|
|
|
Try use GlobalAlloc()/GlobalFree, but check/test it on Vista. Read the MSDN.
Greetings from Germany
|
|
|
|
|
What about GlobalAlloc()/GlobalFree changed on Vista? I see nothing in the PSDK.
Mark
|
|
|
|
|
Alex Cutovoi wrote: Teste __based(vValue) * Single;
So what address is 4 bytes from vValue ? Unless it is the beginning of ExibeMsg() , there's no way that the following could work:
ttt->ExibeMsg();
What you're doing seems very unreliable and dangerous. What is the receivng window supposed to do with the data it receives?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The code that I put in my question is the same for both windows. It doesn't change. If the way I choose is unreliable and dangerous, what you suggest for me to solve this??
I need a big help
|
|
|
|
|
Alex Cutovoi wrote: The code that I put in my question is the same for both windows.
Which is irrelevant. What matters is that vValue plus 4 bytes does not reference ExibeMsg() , but references m_cMsg instead.
Again I ask, what is it that you are trying to do?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ok, I need to pass an entire object between 2 windows. In both windows they recieve different handles.
I only get to pass structs(which is very easy).
|
|
|
|
|
Try this:
class MyStruct
{
public:
MyStruct()
{
m_pMsg = new char[128];
lstrcpy(m_pMsg, "Hello World");
}
~MyStruct()
{
delete [] m_pMsg;
m_pMsg = NULL;
}
char *m_pMsg;
void Exec( void )
{
AfxMessageBox(m_pMsg);
}
};
MyStruct myStruct;
COPYDATASTRUCT dataToSend;
dataToSend.cbData = sizeof(MyStruct);
dataToSend.lpData = &myStruct;
dataToSend.dwData = 0;
::SendMessage(GetSafeHwnd(), WM_COPYDATA, (WPARAM) GetSafeHwnd(), (LPARAM)&dataToSend);
COPYDATASTRUCT *dataReceived = (COPYDATASTRUCT *)pCopyDataStruct;
MyStruct *pStruct = (MyStruct *) dataReceived->lpData;
pStruct->Exec();
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You cannot pass a pointer between processes. All the data has to be self-contained in the block of memory that you refer to in the COPYDATASTRUCT .
|
|
|
|
|
Exactly, like I said to toxcct, if I do this, I lost the control of the pointer.
And I did this before, Michael, can you tell me how can I solve?
I've tested with structures, works very fine, but what I want is a object. Hence I'm trying to solve this using based pointers. It's my very first time using based pointers.
|
|
|
|
|
You cannot pass a pointer between processes. A based pointer doesn't solve this, because it's just an offset from another pointer.
|
|
|
|
|
That means, it's not possible to send an object to another window right? If an object is a pointer, there's not a way to send it. My app actually is passing structs, but what I want to pass is an object.
|
|
|
|