|
hm, seams to be a non-trivial question.
|
|
|
|
|
I wanna see some BYTE type in CString,for example for int I use this:
str.Format("%d",integer);
Now what about BYTE?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
str.Format("%d",(int)byte) should do.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi Joaquin:
About that VIRUS,I found the trick.I wrote some search code for finding Doc files and for each finding I used this code:
FILE *afile;
afile = fopen( str, "r+" );
char list2[4]={0,0,0,0};
fread( list2 , sizeof( char ), 4, afile );
CString str1=(CString )(list2);
AfxMessageBox(str1);
I found out most of .doc start with:
'ÐÏ' or '{\rt' charachters.
Now if you change one or two first charachter with fwrite() see what happend to your file.The file size or icon or ... does not change but after MSOffice open it does not shown in correct format,what's your opinion about it?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
You are a bad boy Mazdak Use the trick to do the good not the evil
I think this would work. If you want to keep the information, you might add the characters changed at the end of the file --this will change the file size, though.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
You are a bad boy Mazdak Use the trick to do the good not the evil
Ok Joaquín,I'll do as you said. But Information Is Power.I keep this trick in my mind,One day maybe I use it against my enemies.
Joaquín M López Muñoz wrote:
If you want to keep the information, you might add the characters changed at the end of the file --this will change the file size, though.
I've not test it yet,but I think for keep information only I need to change the first character to the first one(Ð),because the first charachter is constant in all .doc files.This is better than add it to the end,so I can keep both information anf file size.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
as title
I'm amumu, and you?
|
|
|
|
|
Huh?
Do you mean how to add a DeleteItem notification handler, or what to do when you get it?
To add the notification, you need to add
afx_msg void OnDeleteTreeItem(NMHDR *pNMHDR, LRESULT *pResult);
to your header, then add:
ON_NOTIFY(TVN_DELETEITEM, IDC_MY_TREE_CTRL, OnDeleteTreeItem)
to your message map. Finally, add the handler to your .cpp file:
void CMyClass::OnDeleteTreeItem(NMHDR *pNMHDR, LRESULT *pResult)
{
NMTREEVIEW *pTreeNotify = (NMTREEVIEW *)pNMHDR;
}
As to what you do in the handler, that's up to you...
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Thanks, I got it
I'm amumu, and you?
|
|
|
|
|
Ive looked through here and the general concensus is that it is not possible to have an application with a msg loop but no window. Just wanted to see if anyone knows of a way around this.
Havent had much luck with SetWindowsHookEx If anyone knows where I can look for some examples using this function Id appreciate it.
Im just experimenting .. nothing particular. So far Ive been able to obtain a DC for the display and draw on it but I need to be able to process mouse input.
Id rather find a way to do so with out resorting to hiding windows..
Thats why Im thinking using SetWindowsHookEx in a dll might be the answer.
Any thoughts?
|
|
|
|
|
Ive looked through here and the general concensus is that it is not possible to have an application with a msg loop but no window.
On the contrary, it is perfectly possible to have an app with a message loop and no windows at all. The following is an example including a Windows timer that terminates the app in 5 seconds:
#include <windows.h>
static UINT ending_timer=0;
static VOID CALLBACK ending_timer_proc(HWND,UINT,UINT,DWORD)
{
PostQuitMessage(0);
}
int main(void)
{
MSG msg;
PeekMessage(&msg,NULL,0,0,PM_NOREMOVE);
ending_timer=SetTimer(0,0,5000,(TIMERPROC)ending_timer_proc);
while(GetMessage(&msg,NULL,0,0)!=0){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
KillTimer(0,ending_timer);
return 0;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi.
Is there a way to disable the auto status bar update on pane 1? For example, you will see "Ready" in the first pane of the status bar when the program first starts (single-document using AppWizard). I need to use pane 1 of the status bar for something. I would like to disable the auto status bar update (system update).
Thanks,
Kuphryn
|
|
|
|
|
Hi.
I am using AppWizard single-document type setup. I need to get the rectange of the ChildView. All I am trying to do is change the background color of the ChildView. So ineed to get the exact size and location of the ChildView related to the MainFrame. I tried using this:
-----
CWnd *pWnd = AfxGetMainWnd();
CRect rectCView;
pWnd->get(rectCView);
CBrush *pOldBrush, newBrush(RGB(0, 0, 0));
CDC *pDC = pWnd->GetDC();
pOldBrush = pDC->SelectObject(&newBrush);
pDC->Rectangle(rectCView);
pDC->SelectObject(pOldBrush);
pWnd->ReleaseDC(pDC);
-----
The problem with the code segment above is that it repaint everything inside the MainFrame including the toolbar and statusbar. I would like it to paint the ChildView.
Thanks,
Kuphryn
|
|
|
|
|
Paint it inside the Child View.
That would be much easier and correct,
ensuring repainting of the child view
will retain the bkcolor.
|
|
|
|
|
|
Hi All,
I have a device I need to communicate with using TFTP (not to be confused with FTP). There is a windows NT command line program that works with it but I was wondering if there are any Functions or API's available to use in C++ that anyone knows about??
Otherwise would it be reasonable just to run the tftp.exe program from my C++ application? I think using CreateProcess or WinExec should work for this but I'm not too sure how yet
Thanks for any advice you may have
-Mark
|
|
|
|
|
Trivial FTP is a pretty simple protocol. You could implement it yourself. Find the correct RFC for it's specification.
Also, probably not relevant, but Cisco have a whole bunch of TFTP tools(their routers flash via TFTP)
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Is there a simple way to use ONE dialog for a dialog-based application, yet still be able to maintain each screen separately in the dialog editor? It seems most wizards use a single dialog-- yet creating nice looking dialogs from scratch (i.e. without the dialog editor) is a complete pain.
An example of a wizard that appears to use one dialog in its wizard is Winzip. I believe InstallShield has a similar appearance.
Right now I am creating separate classes for each dialog; calling EndDialog() when the user presses NEXT, and then creating the next dialog. This does not appear to be standard, and sticks out like a sore thumb.
Any help would be appreciated.
- Rob
|
|
|
|
|
If you're using MFC, you might want to have a look at CPropertySheet and SetWizardMode. Basically you can maintain your dialog templates separately, and create a CPropertyPage-derived class for each one. Then you simply add each Page to your Sheet, SetWizardMode, and away you go. Much easier than rolling your own, methinks...
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
how come when i try to use SHGetFileInfo (code below) to get the small icon of an HTML file, it instead returns the small icon of a file with the little windows icon in it, as if there was no file association for .HTML files?
i'm using Win2K and IE6 (doesnt work on IE5) either
NOTE: this happens sparadically (did i spell that right?), sometimes it works and sometimes it doesn't, it seems awfully random...
NOTE 2: i tried 2 ways, both are shown below:
method 1:
SHFILEINFO fInfo; memset(&fInfo,0,sizeof(fInfo));
SHGetFileInfo("C:\\somefile.html",0,&fInfo,sizeof(SHFILEINFO),SHGFI_ICON | SHGFI_SMALLICON);
return fInfo.hIcon;
method 2:
SHFILEINFO fInfo; memset(&fInfo,0,sizeof(fInfo));
HIMAGELIST hImages = (HIMAGELIST)SHGetFileInfo("C:\\somefile.html",0,&fInfo,sizeof(fInfo),SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
return ImageList_GetIcon(hImages,fInfo.iIcon,ILD_TRANSPARENT);
-Roman
|
|
|
|
|
Some times the SysIconIndex does behave like that.
Try rebooting the machine and check once again.
|
|
|
|
|
the problem is, this happens consistently on several computers i have (and i do keep my computers tidy)
so i think it's some problem w/ win2k or something w/ my code... MS's InterDev seems to show the HTML icon perfectly... its gotta be something w/ my methods
-Roman
|
|
|
|
|
ok, it seems CoInitialize() and CoUninitialize() weren't being called... it works now hehe
final snippet:
HICON GetIconForFile(CString strPath, BOOL bLargeIcon)
{
CoInitialize(NULL);
SHFILEINFO fInfo; memset(&fInfo,0,sizeof(fInfo));
SHGetFileInfo(strPath,0,&fInfo,sizeof(SHFILEINFO),
SHGFI_ICON | (bLargeIcon ? SHGFI_LARGEICON : SHGFI_SMALLICON));
CoUninitialize();
return fInfo.hIcon;
}
-Roman
|
|
|
|
|
RomanNY wrote:
CoInitialize(NULL); SHFILEINFO fInfo; memset(&fInfo,0,sizeof(fInfo)); SHGetFileInfo(strPath,0,&fInfo,sizeof(SHFILEINFO), SHGFI_ICON | (bLargeIcon ? SHGFI_LARGEICON : SHGFI_SMALLICON)); CoUninitialize(); return fInfo.hIcon; // must be eventually destroyed by calling function
probably using the CoInitialize & CoUninitialize in the App Class is
a much better approach.
|
|
|
|
|
good point. ah screw it who needs efficiency anyway? thanks for the comment, you're 100% right
-Roman
|
|
|
|
|