|
Sorry, it should be PBYTE (in C++, a pointer to byte). I'm not going to pass String values, I want to pass binary data to an COM object.
|
|
|
|
|
Dear friends, How to get properties of any control ie created by any application (not window styles, extended styles) eg: Delphi.
waiting for reply
Thanks,
Raman.
|
|
|
|
|
I want to make a serial port communication program. I define a STRUCT variable
struct _COMM_PACK
{
char sID[PACK_ID_LEN];
BYTE cCmdCode;
UINT nVerifySum;
int nDataLen;
BYTE cData[MAX_DATA_LEN];
}aSendPack;
and want to send 'aSendPack'in the Mscomm control-comm like:
comm.SetOutput(aSendPack);
but the SetOutput need a VARIANT variable
how can I do that?
thanx!
|
|
|
|
|
! DONT use the MSCOMM control !
If you have to one would...
aSendPack var;
ZeroMemory(&var,sizeof(var));
var.cCmdCode = 0x0100;
etc. etc.....
and finally
comm.SetOutput((char*) &var);
Normski. - the next bit of code is self modifying ... jmp 0xCODE
|
|
|
|
|
Hello,
I am using Installshield for VC++ 6.0 to build a setup program for my program. I was wondering how can I add a shortcut in the startmenu for my programs exe file in the start menu.
Right now .. I am using the follwing code to make the icon in the startmenu
svPath = TARGETDIR ^ "TDMS2000.exe";
LongPathToQuote ( svPath , TRUE );
AddFolderIcon (FOLDER_PROGRAMS^SHELL_OBJECT_FOLDER , "TDMS2000" , svPath , "" , "" , 0 , "" , REPLACE );
But there is a problem with this code. My program needs a .dat file to start that resides in the same directory as the exe file. So when I follow the link created in my start meny using the code above .. the program fails to see that .dat file. When I create a shortcut manually and place it in the start menu .. the program works file.
I will really appreciate any solution to this problem. Thanks!
Sincerely,
Anjum.
|
|
|
|
|
I think the problem is not with the insatalshield but in ur application code..
Ur reading for sat file may be wrong..(i.e)The path u have given for reading the .dat file is relative with ur exe....So the application is searching is the oath where start menu short cut resides....
U have to explictily give the full path of ur exe dor reading the .dat file..
If u can give the code for reading of .dat file and i can clearly analaysis the problem
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Mani,
Thanks for your response. Yes, I am using a relative path, but I was doing it thinking that since the user may choose to install the my program under any folder, I should give a relative so that it will be able to open the my .dat file as long as they are together in one folder regardless of the folder chosen by the user during installation.
When I manually create a short cut of my EXE file and put it on the desktop or in the start menu .. it reads the .dat file fine. I was thinking that an icon created by the setup program should work the same way.
I am attaching my code. Thanks for looking into it.
<br />
char *pszFileName="config.dat";<br />
char pszIName[256];<br />
CFile myFile;<br />
CFileException fileException;<br />
if ( !myFile.Open( pszFileName, CFile::modeRead, &fileException ))<br />
{<br />
::MessageBox(NULL, "File doesnt exist ","Warning",MB_OK);<br />
<br />
}
Also I have a trivial question. Why do I have to put :: before Messagebox function sometimes to make it work. Sometimes it is works without the dots.
As you can probably see that I do lack some of basic knowledge of MFC.
Thanks for your help!
Sincerely,
Anjum.
|
|
|
|
|
Yeah thats the problem.......
U should nver give the relative path..I will not work...In this code when u run with start menu it will search the folder of startmenu and never the exe..So its better u use Absolute path of exe...
So use this piece of code..
<br />
CString StrLaunched;<br />
TCHAR szFullPath[MAX_PATH];<br />
TCHAR szDir[_MAX_DIR];<br />
TCHAR szDrive[_MAX_DRIVE];<br />
::GetModuleFileName(NULL,szFullPath,MAX_PATH);<br />
_splitpath(szFullPath, szDrive, szDir, NULL, NULL);<br />
StrLaunched.Format(_T("%s%s"), szDrive, szDir);<br />
char *pszFileName=StrLaunched+"config.dat";<br />
This will work.....
Then :: means ur calling an Windows Sdk function
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
I can't seem to get the scroll bar of my edit box to display on the left. I've tried using the left scroll bar style but the scroll bar stays on the right. How do I get it to display on the left.
-Raffi
|
|
|
|
|
Scroll bars can be aligned to the left (using the WS_EX_LEFTSCROLLBAR style), but they take effect only in Hebrew and Arabic versions of Windows 95 (and any languages whose characters can be read from the right).
You give no reason for which a left-aligned scroll bar would be beneficial.
Peter O.
|
|
|
|
|
I get the following error when I use DAO with a text file:
<filename> is not a valid file path. ...
Could someone tell me what I am doing wrong?
CString sFile = "c:\\ashish.txt";
CDaoDatabase db;
CDaoRecordset rs;
db.Open(sFile,FALSE,TRUE,"Text;");
.
.
.
Thanks
ashish
|
|
|
|
|
Hello,
The msdn document says the insertion mark is available for windows XP
Visual Styles. But I don't see this the insertion mark present even I have
a manifests in my program. Do you have any idea how to enable it?
Thanks,
Hiusing
|
|
|
|
|
|
I need to get VK_RIGHT but I cant seem to figure this out...
void CAlienMemoryDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// key is pressed
int x;
x = -1;
CDC *xDC=GetDC();
switch(nChar)
{
case VK_DOWN: // down arrow key
{
break;
}
case VK_UP: // up arrow key
{
break;
}
case VK_RIGHT: // right arrow key
{
m_CurrSelected++;
if (m_CurrSelected > 11)
m_CurrSelected = 0;
x = 0;
break;
}
case VK_LEFT: // left arrow key
{
m_CurrSelected--;
if (m_CurrSelected < 0)
m_CurrSelected = 11;
x = 1;
break;
}
}
if (x > -1) {
Game.SelectImage(m_CurrSelected,xDC,x);
}
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}
VK_LEFT works but VK_RIGHT doesnt
|
|
|
|
|
|
Hi!
can anybody help me out with it? I need to write a MFC-free app that supports drag-drop via OLE (I use the WM_DROPFILES method already but it's not sufficient). I have a hard time figuring it out. Even MSDN says use COleDataSource as if nobody ever programmed for WinAPI (Is there anybody out there/Pink Floyd). Can anybody give me some clues? A snippet would be COOL. Thanks a lot
|
|
|
|
|
I seem to be losing my 'stdin' when I redirect my stdout/stderr (using freopen). Better put, the stdin seems to become flaky...
Does this make sense to anyone?
Is there a better way to get keystrokes from a (DOS/console/Win2k) app than using getch()? w/o using an event loop?
Thanks in advance....!
|
|
|
|
|
has anyone here ever sucessfully implemented smooth drag-n-drop for a listctrl in 'icon' view ?
i've searched the web for days for a way to do it (yes, i've seen codeguru) , but everything i've found and everything i've tried results in horrible flicker.
fyi, the flicker is casued because, in MouseMove, UpdateWindow on the listctrl to redraw what the drag image has uncovered, then i redraw the drag image in the new spot. so, each move, i have to redraw the list, the redraw the drag image.
i've tried all kinds of variations on LockWindowUpdate, DragShowNolock, UpdateWindow, etc... nothing seems to get rid of the flicker.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
there are some articels called flicker free MFC or what. you double buffer your listview and it doesn flicker no more...
btw. anyone knows how to do drag and drop WITHOUT MFC (pure WinAPI)?
|
|
|
|
|
its a bitch apparently
try looking thru the mfc source for the drag and drop they implemented ... it might be a good starting point
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
What all are you doing in your drag? Just moving a drag image over the list, or are you drawing insertion marks, etc.? I've never had serious problems with the first, but *always* get something wrong with the second.
Shog9
--
Maybe Java is kind of like God, it "works in mysterious ways". It seems like your apps are running slowly, because in the backgroud Java is solving world hunger, or finding the cure to cancer.
- Ryan Johnston, Don't die java!
|
|
|
|
|
The same thing I want to do.I have two list views .Left list contains directories,subdirectories and files. I should be able to select some part of the list and should be able to drag and drop into the right pane(or list view) and copy these dirctoris and files into a particular location.How can implement this?Any existing code is there so that I can resuse it in my application?
please help me.I am running out of deadlines.
Thanks in advance.
Pathi
Pathi
|
|
|
|
|
Check out this article, and also the Shell Programming sections.
Shog9
--
Maybe Java is kind of like God, it "works in mysterious ways". It seems like your apps are running slowly, because in the backgroud Java is solving world hunger, or finding the cure to cancer.
- Ryan Johnston, Don't die java!
|
|
|
|
|
it's an icon view, so i don't have an insertion mark.
what i do in OnMouseMove (currently, and it works no worse or better than anything else i've tried):
1. HitTest to see which item the drag is over
2. if it's an item (and not the item we were over the last time), set the new item highlight state and clear the old item's highlight state
3. regardless of hittest:
DragShowNolock(false)
UpdateWindow
DragShowNolock(true)
DragMove
4. then handle the out-of-rect stuff to do an autoscroll effect (this isn't the cause of the flicker, as it only kicks in when you've left the client rect)
i can move the DragShowNolock(false) anywhere before 3, with no effect
i can put the DragMove anywhere with only slight effect. sometimes, i can make it so the drag image is under the list items.
i get a really nice smooth draw if i get rid of both DragShowNolock calls, but then the listview items don't repaint themselves correctly.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
A possibility for you might be to use the technique Windows Explorer appears to use on Win2k and up. Handle the d&d process as you are now, but instead of using the ImageList d&d support functions, create a small window to display the drag image and position it under the cursor. When the mouse moves, do the highlight and reposition the drag window. If running on Win2k and up, you can use the WS_LAYERED style to prevent excessive redraw as portions of the list are uncovered - and as a side bonus do that cool faded-edges effect like Explorer
I might try a test implementation later, will let you know if it works well.
Shog9
--
Maybe Java is kind of like God, it "works in mysterious ways". It seems like your apps are running slowly, because in the backgroud Java is solving world hunger, or finding the cure to cancer.
- Ryan Johnston, Don't die java!
|
|
|
|