|
okay what I want to do is be able to open a serial port and then set and clear the str and rts whenever I want to.
For example:
open com port
do stuff
set dtr
send data
wait so long
clear dtr
Hear is what I have tried that I thought should work:
int result = EscapeCommFunction(_hCom,SETDTR);
WriteFileEx(_hCom,"\xFF",1,test,0);
Sleep(4);
result = EscapeCommFunction(_hCom,CLRDTR);
this was unsuccessful though the EscapeCommFunction returned successful (1).
Since that didn't work I tried this
BuildCommDCB("dtr = on", &dcb);
SetCommState(_hCom, &dcb);
WriteFileEx(_hCom,"\xFF",1,test,0);
Sleep(4);
BuildCommDCB("dtr = off", &dcb);
SetCommState(_hCom, &dcb);
which was equally as unsuccessful.
What am I doing wrong?
edited to try to fix reference (&) marks
|
|
|
|
|
this is going to sound so stupid. But it works now I had the OScope on the wrong pin.
~Brandy
|
|
|
|
|
One thing to note: your call to Sleep(4) will not sleep for exactly 4 milliseconds. It will probably sleep on the order of 10-20 milliseconds, depending upon the thread quantum (the thread-switching time).
|
|
|
|
|
For more information on timing, you may want to read my timers article.
|
|
|
|
|
I need to have my makefile select one file type(.mesh) in a data folder and then send it to a converttool.exe (in a different directory)
Does anyone know the commands I must use?
I tried searching around but couldn't find an answer. Thanks in advance.
This is what I am working with now and nothing seems to be happening (just some of the makefile)...
<br />
DATA := data<br />
OGRETOOLS := $(OGRE_HOME)/OgreCommandLineTools<br />
MESHFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)
|
|
|
|
|
try this, might be because OgreXmlConverter.exe doesnot take mutiple file names in the command line
content: $(MESHFILES)
$(MESHFILES):
$(OGRETOOLS)/OgreXmlConverter.exe $@
i know gmake supports wildcard target, i don't remember the syntax, then replace the line below,
$(MESHFILES):<br />
$(OGRETOOLS)/OgreXmlConverter.exe $@
with
*.mesh:<br />
$(OGRETOOLS)/OgreXmlConverter.exe $@
modified on Monday, July 21, 2008 8:03 AM
|
|
|
|
|
I have an old MFC application that I am trying to modify. In the new code I am opening an xml file using the MSXML DOM. When I make function calls to the xml dom document I want to be able to use my help just like all the old stuff by just putting the cursor in front of the function and pressing F1 (call me old fashioned). The problem is when I do this on the xml dom functions my MSDN library does not seem to have the documentation installed and therefore the help pops up but it doesnt find my function. Does anyone know what I need to install to get this xml dom stuff in my help documentation and where to get it?
Note: I am using Microsoft Visual C++ 6.0
Rock
|
|
|
|
|
I have no idea but you can find the documentation you need online on MSDN. Unless you are using ATL generated classes then I do not believe there is any because the generated classes are just pass through to the COM interfaces.
led mike
|
|
|
|
|
Yeah the COM thing, thats what I was afraid of. I know the documentation is online but like I said I'm old fashioned and just like tp press F1 to immediately see the help for the function I am using as opposed to searching and trying to find the right instance of the function for c++\mfc
Rock
|
|
|
|
|
Hi,
I'm using Extended MAPI to read and create calendar events in outlook, and as far as it goes, it's working nicely. However, I can only read and write events in the default calendar, but need to be able to access any calendar the user has access to. Here's a brief code snippet showing how I access the calendar (error checking etc removed)...
m_pMAPILogonEx(NULL, NULL, NULL, MAPI_EXTENDED | MAPI_LOGON_UI | MAPI_NEW_SESSION, &pSession);
pSession->GetMsgStoresTable(0, &pStoreTable);
SPropTagArray sptaEid = {1, {PR_ENTRYID}};
SRestriction res;
SPropValue spv;
res.rt = RES_PROPERTY;
res.res.resProperty.relop = RELOP_EQ;
res.res.resProperty.ulPropTag = PR_DEFAULT_STORE;
res.res.resProperty.lpProp = &spv;
spv.ulPropTag = PR_DEFAULT_STORE;
spv.Value.b = TRUE;
SYSTEMTIME st;
pHrQueryAllRows( pStoreTable, &sptaEid, &res, NULL, 1, &pRows );
LPSBinary pEntryId = &pRows->aRow[0].lpProps[0].Value.bin;
pSession->OpenMsgStore(0, pEntryId->cb, (LPENTRYID)pEntryId->lpb, NULL, MAPI_BEST_ACCESS, &pStore);
SBinary eidInbox;
pStore->GetReceiveFolder(NULL, 0, &eidInbox.cb, (LPENTRYID*)&eidInbox.lpb, NULL);
pStore->OpenEntry(eidInbox.cb, (LPENTRYID)eidInbox.lpb, NULL, MAPI_BEST_ACCESS, &ulObjType, (LPUNKNOWN*)&pMailbox);
pHrGetOneProp(pMailbox, PR_IPM_APPOINTMENT_ENTRYID, &pCalendarEid);
The key here is that PR_IPM_APPOINTMENT_ENTRYID gives me the entry id for the default Outlook calendar. But Outlook allows me to create other calendars, and I can see them using OutlookSpy (They appear to be at the same level as the default calendar). I want to access these other calendars, but can't seem to get the entry id in order to open them. I thought I might be able to step through all the entries in the receive folder, and look for entries with PR_CONTAINER_CLASS == "IPM.Appointment", but I get an error if I try to access property PR_CONTAINER_CLASS. Another code snippet...
IMAPITable *pReceiveFolderTable = NULL;
pMailbox->GetContentsTable(MAPI_UNICODE, &pReceiveFolderTable);
SizedSPropTagArray( 2, receiveFolderTableColumns ) = { 2, {PR_ENTRYID, PR_CONTAINER_CLASS} };
hResult = pReceiveFolderTable->SetColumns((LPSPropTagArray)&receiveFolderTableColumns, 0);
SRowSet *pReceiveFolderRows = NULL;
SRow *pReceiveFolderRow = NULL;
hResult = pReceiveFolderTable->QueryRows( 100, &pReceiveFolderRows );
while( ( hResult == S_OK ) && pReceiveFolderRows && pReceiveFolderRows->cRows > 0 )
{
for( ULONG i = 0; i < pReceiveFolderRows->cRows; i++ )
{
if( PROP_TYPE( pReceiveFolderRow->lpProps[1].ulPropTag ) != PT_ERROR )
{
Write something to log file. Never gets here, as ulPropTag is always PT_ERROR
}
}
}
Does anyone know how I can access these other calendars, or have any suggestions of where I could go for help?
And as if that wasn't enough, I have a second question...
When creating an Outlook appointment, I'd like to supply an email address (or a list of addresses) and have Outlook send an email notification to those addresses. Does anyone know which properties I need to set? And do I need to separately tell Outlook to send the notification, or can it figure that out if set the appropriate properties in the appointment? So far, I've set the named property 0x823b to an email address, and experimented in OutlookSpy with various other fields, but with no success.
Any help or pointers greatly appreciated,
Regards,
Terry Smyth (Got this far, but still a MAPI novice!)
|
|
|
|
|
Hi everybody!
I developped an application by using c++ windows forms (msdn).
I am trying to save picture in pgm format from the picturebox of my application. I tried to modify and use the C# code provided by this link http://www.codeproject.com/KB/cs/Managed_PGM.aspx
But my application always generate a couple errors that I couldn't fix.
Thank you in advance for your help.
|
|
|
|
|
Can anyone help me to get the co-ordinates of a button in a dialog. I have tried with GetWindowRect and GetClientRect. Both are giving the window position only. I need the co-ordinates of a button control in a window. More interestingly, I can get the co-ordinates using the above methods for Picture control and Static control. Please advice.
Many thanks in advance.
|
|
|
|
|
|
Alan Balkany wrote: After you get the screen coordinates of the button
Hello alan,
Thank you very much for your reply. Can you please tell me how to get the screen coordinates of the button.
Many thanks in advance.
modified on Friday, July 18, 2008 10:29 AM
|
|
|
|
|
For example:
RECT rect;
GetDlgItem (IDC_BUTTON1)->GetWindowRect (&rect);
ScreenToClient (&rect);
|
|
|
|
|
Dear Alan,
Thank you very much for your reply. I have the code below as per your guidance. But when I place the mouse over the button the Messagebox is not displayed, instead it is appearing when I place the mouse on the to area of the dialog window, but my control is placed on the bottom of the dialog window. Please advice.
void CdfdgDlg::OnMouseMove(UINT nFlags, CPoint point)
{
GetDlgItem (IDC_BUTTON9)->GetWindowRect (&rect);
ScreenToClient (&rect);
ClientToScreen(&point);
if (rect.PtInRect(point))
{
MessageBox(L"Correct");
}
CDialog::OnMouseMove(nFlags, point);
}
|
|
|
|
|
The line, ClientToScreen(&point); is incorrect. I think this point is already in client coordinates, so remove this line.
|
|
|
|
|
Hello Alan,
I tried like the below. Strangely, when placing mouse over the button changes the bitmap and when I move the mouse over the dialog the button is painted again and again. If I place the mouse over other non-bitmap button and place again over the bitmapbutton didn't change the image. That is the event is triggered for the first time only.
ON_WM_MOUSEMOVE()
ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave)
LONG CdfdgDlg::OnMouseLeave(WPARAM , LPARAM)
{
POINT point;
GetCursorPos(&point);
ScreenToClient(&point);
GetDlgItem (IDC_BUTTON4)->GetWindowRect (&rect);
ScreenToClient (&rect);
if (rect.PtInRect(point))
{
bool val=m_button4.LoadBitmaps(IDB_BITMAP4,0,IDB_BITMAP4,0);
m_button4.Invalidate();
m_button4.UpdateWindow();
}
return 0;
}
void CdfdgDlg::OnMouseMove(UINT nFlags, CPoint point)
{
TRACKMOUSEEVENT trackmouseevent;
trackmouseevent.cbSize = sizeof(trackmouseevent);
trackmouseevent.dwFlags = TME_LEAVE;
trackmouseevent.hwndTrack = GetSafeHwnd();
trackmouseevent.dwHoverTime = HOVER_DEFAULT;
_TrackMouseEvent(&trackmouseevent);
GetDlgItem (IDC_BUTTON4)->GetWindowRect (&rect);
ScreenToClient (&rect);
if ((!rect.PtInRect(point)) )
{
mouse=true;
bool val=m_button4.LoadBitmaps(IDB_BITMAP2,0,IDB_BITMAP2,0);
m_button4.Invalidate();
m_button4.UpdateWindow();
}
CDialog::OnMouseMove(nFlags, point);
}
modified on Monday, July 21, 2008 8:50 AM
|
|
|
|
|
I'm not sure what your question is. It looks like you're reloading the button bitmaps every time there's a mouse move in your dialog, which probably isn't what you want to do.
|
|
|
|
|
Dear Alan,
Actually I am reloading the button everytime, because I have to change the bitmap of the button when mouse is over and mouse is leave from the button.
That's why I am reloading the bitmap of the button everytime there is mouse move and every time mouse over the button. Please advice me a good way to do this.
Many thanks in advance.
|
|
|
|
|
OnMouseLeave () will only be called when the mouse leaves the dialog -- not the button.
Try handling both cases (mouse in button, mouse out of button) in the OnMouseMove () handler.
|
|
|
|
|
bhanu_8509 wrote: Both are giving the window position only.
Maybe because you are calling them in the context of a window rather than a control. You may, however, be getting screen and client coordinates confused.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
There are many ways, but try something like this:
HWND hwndControl = ::GetDlgItem(GetSafeHwnd(), IDC_PICTUREBOX);
ASSERT(hwndControl);
CRect rec;
VERIFY(::GetWindowRect(hwndControl, &rec));
VERIFY(::MapWindowPoints(NULL, GetSafeHwnd(), reinterpret_cast<LPPOINT>(&rec), 2) != 0 );
This code assumes that it's in a member function of the dialog. By using the raw Win32 functions I'm avoiding the overhead of MFC's handle maps.
Steve
|
|
|
|
|
Hello all,
Please help me...
I am creating Stored Procedure programmatically using db_command
code is some thing like
[
db_command(".. very long SQL stored procedure string....")
]
my stored procedure command string is too long..
while compiling I am getting this "error C2026: string too big, trailing characters truncated" error.
Thanks in advance..
|
|
|
|
|
According to this page [^] you may try to split it into two adjacent string literals.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|