|
Hi community,
i have a funktion to count files in a directory and its subdirectory, but how to count a ADS files, alternate da ta stream?
How to pas a path to FindFile() and FindNextFile() ??
I try to make a path from a visible file like:
"C:\visible.txt" to "C:\visible.txt:*.*" but this is not correct.
Does any one knows how to do this?
Thanks in advance
bosfan
|
|
|
|
|
Your path should be something like:
char* szPath = "C:\\directory\\*.ads";
You must always escape the special characters, such as backslash, in string constants in C/C++, by prefixing them with the escape character, which is a backslash. In your example you are escaping the first character (v ) of the word visible .
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
ADS files is not file with ADS extension , it's :
windows alternate data streams.
ADS Files[^]
|
|
|
|
|
Use this Code :
Streams.h
typedef INT NTSTATUS;
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
#define STATUS_BUFFER_OVERFLOW ((NTSTATUS)0x80000005L)
typedef struct _IO_STATUS_BLOCK {
NTSTATUS Status;
ULONG Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
typedef VOID (*PIO_APC_ROUTINE) (
PVOID ApcContext,
PIO_STATUS_BLOCK IoStatusBlock,
ULONG Reserved
);
typedef enum _FILE_INFORMATION_CLASS {
FileDirectoryInformation = 1,
FileFullDirectoryInformation,
FileBothDirectoryInformation,
FileBasicInformation,
FileStandardInformation,
FileInternalInformation,
FileEaInformation,
FileAccessInformation,
FileNameInformation,
FileRenameInformation,
FileLinkInformation,
FileNamesInformation,
FileDispositionInformation,
FilePositionInformation,
FileFullEaInformation,
FileModeInformation,
FileAlignmentInformation,
FileAllInformation,
FileAllocationInformation,
FileEndOfFileInformation,
FileAlternateNameInformation,
FileStreamInformation,
FilePipeInformation,
FilePipeLocalInformation,
FilePipeRemoteInformation,
FileMailslotQueryInformation,
FileMailslotSetInformation,
FileCompressionInformation,
FileObjectIdInformation,
FileCompletionInformation,
FileMoveClusterInformation,
FileQuotaInformation,
FileReparsePointInformation,
FileNetworkOpenInformation,
FileAttributeTagInformation,
FileTrackingInformation,
FileMaximumInformation
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
#pragma pack(4)
typedef struct {
ULONG NextEntry;
ULONG NameLength;
LARGE_INTEGER Size;
LARGE_INTEGER AllocationSize;
USHORT Name[1];
} FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
#pragma pack()
Streams.c
#define UNICODE 1
#include <windows.h>
#include <stdio.h>
#include "streams.h"
NTSTATUS (__stdcall *NtQueryInformationFile)(
IN HANDLE FileHandle,
OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID FileInformation,
IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInformationClass
);
ULONG (__stdcall *RtlNtStatusToDosError) (
IN NTSTATUS Status
);
ULONG FilesWithStreams = 0;
ULONG FilesProcessed = 0;
ULONG DotsPrinted = 0;
BOOLEAN PrintDirectoryOpenErrors = FALSE;
void PrintNtError( NTSTATUS status )
{
WCHAR *errMsg;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, RtlNtStatusToDosError( status ),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &errMsg, 0, NULL );
wprintf(L"%s\n", errMsg );
LocalFree( errMsg );
}
void PrintWin32Error( DWORD ErrorCode )
{
LPVOID lpMsgBuf;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, ErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL );
wprintf(L"%s\n", lpMsgBuf );
LocalFree( lpMsgBuf );
}
BOOL EnableTokenPrivilege( PTCHAR PrivilegeName )
{
TOKEN_PRIVILEGES tp;
LUID luid;
HANDLE hToken;
TOKEN_PRIVILEGES tpPrevious;
DWORD cbPrevious=sizeof(TOKEN_PRIVILEGES);
if(!OpenProcessToken( GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
&hToken )) {
return FALSE;
}
if(!LookupPrivilegeValue( NULL, PrivilegeName, &luid )) return FALSE;
tp.PrivilegeCount = 1;
tp.Privileges[0].Luid = luid;
tp.Privileges[0].Attributes = 0;
AdjustTokenPrivileges(
hToken,
FALSE,
&tp,
sizeof(TOKEN_PRIVILEGES),
&tpPrevious,
&cbPrevious
);
if (GetLastError() != ERROR_SUCCESS) return FALSE;
tpPrevious.PrivilegeCount = 1;
tpPrevious.Privileges[0].Luid = luid;
tpPrevious.Privileges[0].Attributes |= (SE_PRIVILEGE_ENABLED);
AdjustTokenPrivileges(
hToken,
FALSE,
&tpPrevious,
cbPrevious,
NULL,
NULL
);
return GetLastError() == ERROR_SUCCESS;
}
VOID ProcessFile( WCHAR *FileName, BOOLEAN IsDirectory, BOOLEAN Delete )
{
PFILE_STREAM_INFORMATION streamInfo, streamInfoPtr;
ULONG streamInfoSize = 0;
BOOLEAN printedFile = FALSE;
NTSTATUS status;
HANDLE fileHandle;
WCHAR streamName[MAX_PATH];
WCHAR fullStreamName[MAX_PATH];
IO_STATUS_BLOCK ioStatus;
fileHandle = CreateFile( FileName, GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, 0 );
if( fileHandle == INVALID_HANDLE_VALUE ) {
if( !IsDirectory || PrintDirectoryOpenErrors ) {
wprintf(L"\rError opening %s:\n", FileName );
PrintWin32Error( GetLastError() );
}
return;
}
if( !(++FilesProcessed % 500)) {
if( DotsPrinted == 3 ) {
wprintf(L"\r \r");
DotsPrinted = 0;
} else {
DotsPrinted++;
wprintf(L".");
}
fflush( stdout );
}
streamInfoSize = 16384;
streamInfo = malloc( streamInfoSize );
status = STATUS_BUFFER_OVERFLOW;
while( status == STATUS_BUFFER_OVERFLOW ) {
status = NtQueryInformationFile( fileHandle, &ioStatus,
streamInfo, streamInfoSize,
FileStreamInformation );
if( status == STATUS_BUFFER_OVERFLOW ) {
free( streamInfo );
streamInfoSize += 16384;
streamInfo = malloc( streamInfoSize );
} else {
break;
}
}
if( NT_SUCCESS( status ) && ioStatus.Information ) {
streamInfoPtr = streamInfo;
while( 1 ) {
memcpy( streamName,
streamInfoPtr->Name,
streamInfoPtr->NameLength );
streamName[ streamInfoPtr->NameLength/2 ] = 0;
if( wcsicmp( streamName, L"::$DATA" )) {
if( !printedFile ) {
wprintf(L"\r%s:\n", FileName );
printedFile = TRUE;
}
if( Delete ) {
swprintf( fullStreamName, L"%s%s", FileName, streamName );
if( !DeleteFile( fullStreamName )) {
wprintf(L" Error deleting %s:\n", streamName );
PrintWin32Error( GetLastError());
} else {
wprintf(L" Deleted %s\n", streamName );
}
} else {
wprintf(L" %20s\t%I64d\n", streamName, streamInfoPtr->Size.QuadPart );
}
}
if( !streamInfoPtr->NextEntry ) break;
FilesWithStreams++;
streamInfoPtr = (PFILE_STREAM_INFORMATION) ((char *) streamInfoPtr +
streamInfoPtr->NextEntry );
}
} else if( !NT_SUCCESS( status )) {
wprintf(L"\rError on %s: ", FileName );
PrintNtError( status );
}
free( streamInfo );
CloseHandle( fileHandle );
}
void ProcessDirectory( WCHAR *PathName, WCHAR *SearchPattern,
BOOLEAN Recurse, BOOLEAN Delete )
{
WCHAR subName[MAX_PATH], fileSearchName[MAX_PATH], searchName[MAX_PATH];
HANDLE dirHandle, patternHandle;
static BOOLEAN firstCall = TRUE;
WIN32_FIND_DATA foundFile;
if( firstCall ) {
if( PathName[ wcslen( PathName ) - 1] == L'\\' ) {
PathName[ wcslen( PathName ) - 1] = 0;
}
if( wcsrchr( PathName, '*' ) ) {
if( wcsrchr( PathName, '\\' ) ) {
swprintf( SearchPattern, wcsrchr( PathName, '\\' )+1 );
wcscpy( searchName, PathName );
wcscpy( wcsrchr( searchName, '\\')+1, L"*.*" );
} else {
swprintf( SearchPattern, PathName );
wcscpy( searchName, PathName );
}
swprintf( fileSearchName, L"%s", PathName );
} else {
swprintf( SearchPattern, L"*.*" );
if( Recurse ) {
swprintf( searchName, L"%s\\*.*", PathName );
swprintf( fileSearchName, L"%s\\*.*", PathName );
} else {
swprintf( searchName, L"%s", PathName );
swprintf( fileSearchName, L"%s", PathName );
}
}
} else {
swprintf( searchName, L"%s\\*.*", PathName );
swprintf( fileSearchName, L"%s\\%s", PathName, SearchPattern );
}
if( (patternHandle = FindFirstFile( fileSearchName, &foundFile )) !=
INVALID_HANDLE_VALUE ) {
do {
if( firstCall || (wcscmp( foundFile.cFileName, L"." ) &&
wcscmp( foundFile.cFileName, L".." ))) {
wcscpy( subName, searchName );
if( wcsrchr( subName, '\\' ) )
wcscpy( wcsrchr( subName, '\\')+1, foundFile.cFileName );
else
wcscpy( subName, foundFile.cFileName );
ProcessFile( subName,
(BOOLEAN) (foundFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY),
Delete );
}
} while( FindNextFile( patternHandle, &foundFile ));
FindClose( patternHandle );
}
if( Recurse ) {
if( firstCall && !wcsrchr( searchName, L'\\') ) {
if( wcsrchr( searchName, L'*' )) {
if( (dirHandle = FindFirstFile( L"*.*", &foundFile )) ==
INVALID_HANDLE_VALUE ) {
return;
}
} else {
if( (dirHandle = FindFirstFile( searchName, &foundFile )) ==
INVALID_HANDLE_VALUE ) {
return;
}
}
} else {
if( (dirHandle = FindFirstFile( searchName, &foundFile )) ==
INVALID_HANDLE_VALUE ) {
return;
}
}
firstCall = FALSE;
do {
if( (foundFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
wcscmp( foundFile.cFileName, L"." ) &&
wcscmp( foundFile.cFileName, L".." )) {
wcscpy( subName, searchName );
if( wcsrchr( subName, '\\' ) )
wcscpy( wcsrchr( subName, '\\')+1, foundFile.cFileName );
else
wcscpy( subName, foundFile.cFileName );
ProcessDirectory( subName, SearchPattern, Recurse, Delete );
}
} while( FindNextFile( dirHandle, &foundFile ));
}
FindClose( dirHandle );
}
int Usage( WCHAR *ProgramName )
{
wprintf(L"usage: %s [-s] [-d] <file or directory>\n", ProgramName );
wprintf(L"-s Recurse subdirectories\n");
wprintf(L"-d Delete streams\n\n");
return -1;
}
int wmain( int argc, WCHAR *argv[] )
{
BOOLEAN recurse = FALSE, delete = FALSE;
PWCHAR filePart;
WCHAR volume[] = L"C:\\";
DWORD fsFlags;
WCHAR searchPattern[MAX_PATH];
WCHAR searchPath[MAX_PATH];
int i;
if( argc > 1 ) {
for( i = 1; i < argc; i++ ) {
if( argv[i][0] != L'/' && argv[i][0] != L'-' ) {
if( i != argc-1 ) {
wprintf( argv[i] );
return Usage( argv[0] );
}
continue;
}
if( argv[i][1] == L's' || argv[i][1] == L'S' ) {
recurse = TRUE;
} else if( argv[i][1] == L'd' || argv[i][1] == 'D' ) {
delete = TRUE;
} else return Usage( argv[0] );
}
} else {
return Usage( argv[0] );
}
if( EnableTokenPrivilege( SE_BACKUP_NAME )) {
PrintDirectoryOpenErrors = TRUE;
}
if( !(NtQueryInformationFile = (void *) GetProcAddress( GetModuleHandle(L"ntdll.dll"),
"NtQueryInformationFile" )) ) {
wprintf(L"\nCould not find NtQueryInformationFile entry point in NTDLL.DLL\n");
exit(1);
}
if( !(RtlNtStatusToDosError = (void *) GetProcAddress( GetModuleHandle(L"ntdll.dll"),
"RtlNtStatusToDosError" )) ) {
wprintf(L"\nCould not find RtlNtStatusToDosError entry point in NTDLL.DLL\n");
exit(1);
}
GetFullPathName( argv[argc-1], MAX_PATH, searchPath, &filePart );
if( searchPath[1] == L':' ) {
fsFlags = 0;
volume[0] = searchPath[0];
GetVolumeInformation( volume, NULL, 0, NULL, NULL, &fsFlags, NULL, 0 );
if( !(fsFlags & FILE_NAMED_STREAMS )) {
wprintf(L"\nThe specified volume does not support streams.\n\n");
exit(2);
}
}
ProcessDirectory( searchPath, searchPattern, recurse, delete );
if( !FilesWithStreams ) wprintf(L"No files with streams found.\n\n");
return 0;
}
|
|
|
|
|
Hi there,
thanks for help!
That is new for me.
Best Regards
bosfan
|
|
|
|
|
Hi,
in this example i need a WDK installed, is this right?
Because VS 10 don't know a "NtQueryInformationFile" and i found on microsoft.com that i need "ntifs.h" to include for this? After all ntifs.h is on my system but now i can't find "windowsfamiliy.h"
Best wishes
bosfan
|
|
|
|
|
Can somebody try the new innovative C++ RAD Toolkit SmartDB (http://sdb.net.in[^]) and give some feedback.
|
|
|
|
|
This is the wrong place for questions like this; why not try it yourself.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I've 2 nvidia video cards installed on my computer.
And each video card has 2 heads.
So I've got 4 monitors/displays:
display1 & display2 from card 1.
display3 & display4 from card 2.
Now I want to run 2 fullscreen|exclusive DirectDraw applications. each app bind to a different display.
e.g. App 1 bind to display 1 (card1)
App 2 bind to display 3 (card2)
I want to know if this is possible?
because now I am getting DDERR_EXCLUSIVEMODEALREADYSET while trying to SetCooperativeLevel in the second app.
but it's no problem if I run only one app, and bind to any of the 4 displays.
|
|
|
|
|
bowen1981 wrote: I want to know if this is possible?
Eh, not directly, I think.
bowen1981 wrote: because now I am getting DDERR_EXCLUSIVEMODEALREADYSET while trying to SetCooperativeLevel in the second app.
Fullscreenmode in DirectX is always exclusive mode.
The only way I know, is to open two windows that are fullsize without titlebar and min-/maxboxes.
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
Hey there
I have a C++ Windows application using Win32 API's. User can select a control (buttons, text box, drop down...) via using the TAB button on the key board. By default Windows does a drawing by which the selected control looks selected, but is it possible to make it more visible by a color change?
i.e., when the user selects a BUTTON can i make the color of the button change to blue or orange or something like that, thus giving a visual feeling that this is the control that's selected.
BTW, this is a Win32 API app, so which windows messages i need to check for this and make changes?
Thanks in advance
|
|
|
|
|
There is no simple way to do this.
With some controls this may be achieved by changing the text and background colors.
For full customization you must use owner-drawn controls handling the WM_DRAWITEM notification.
You may browse the articles here for some examples (especially buttons[^]), but most of them are using MFC and not Win32.
|
|
|
|
|
|
There is a class A, in a outside library. Now I want to use the way of explicit load librar. I know that it needs to use LoadLibrary to load the dll and use the function GetProcAddress to get the function pointer if use outside function. But how to use the outside class.
|
|
|
|
|
One example[^]
Another[^]
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi,
I am trying to print the content of the CRichEditCtrl. The problem is that when I want to use pagination (with A4 pages), the printed text (which is just 4 sample line with 40 chars at most) at the code
lTextPrinted =FormatRange(&fr,TRUE); is always lesser than the actual text pointed by the lTextLength variable making the loop run for ever. What is the problem with the following code ?
CPrintDialog printDialog(false);
if (bShowPrintDialog)
{
int r = printDialog.DoModal();
if (r == IDCANCEL)
return; }
else
{
printDialog.GetDefaults();
}
HDC hPrinterDC = printDialog.GetPrinterDC();
CDC pMyPrinterDC;
pMyPrinterDC.Attach(hPrinterDC);
FORMATRANGE fr;
int nHorizRes = GetDeviceCaps(hPrinterDC, HORZRES);
int nVertRes = GetDeviceCaps(hPrinterDC, VERTRES);
int nLogPixelsX = GetDeviceCaps(hPrinterDC, LOGPIXELSX);
int nLogPixelsY = GetDeviceCaps(hPrinterDC, LOGPIXELSY);
LONG lTextLength; LONG lTextPrinted;
SetMapMode ( hPrinterDC, MM_TEXT );
fr.hdc = pMyPrinterDC.m_hDC;
fr.hdcTarget = pMyPrinterDC.m_hDC;
long lPageWidth = ::MulDiv(pMyPrinterDC.GetDeviceCaps(PHYSICALWIDTH), 1440, pMyPrinterDC.GetDeviceCaps(LOGPIXELSX));
long lPageHeight = ::MulDiv(pMyPrinterDC.GetDeviceCaps(PHYSICALHEIGHT), 1440, pMyPrinterDC.GetDeviceCaps(LOGPIXELSY));
CRect rcPage(0, 0, lPageWidth, lPageHeight);
SetTargetDevice(hPrinterDC,lPageWidth);
fr.rc = rcPage;
fr.rcPage = rcPage;
fr.chrg.cpMin = 0;
fr.chrg.cpMax = -1;
this->FormatRange(&fr,TRUE);
DOCINFO di;
ZeroMemory(&di, sizeof(di));
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = "GnosisExplorerNotes";
di.lpszOutput = NULL;
RECT rcClient;
GetClientRect(&rcClient);
DisplayBand(&rcClient);
StartDoc(hPrinterDC, &di);
lTextLength = GetTextLength();
do {
StartPage(hPrinterDC);
lTextPrinted =FormatRange(&fr,TRUE);
DisplayBand(&fr.rc );
EndPage(hPrinterDC);
if (lTextPrinted < lTextLength) {
fr.chrg.cpMin = lTextPrinted;
fr.chrg.cpMax = -1;
}
} while (lTextPrinted < lTextLength);
FormatRange(NULL,false);
EndDoc (hPrinterDC);
DeleteDC(hPrinterDC);
pMyPrinterDC.DeleteDC();
sdancer75
|
|
|
|
|
I ended up that the RichEditCtrl version 2 causes this problem.
Using RichEditCtrl version 1 it works fine.
Any solution ?
I am attaching the source code. Please check that the lTextPrinted is always lesser than lTextLength.
https://rapidshare.com/files/2018160716/RichEditDlg.zip[^]
sdancer75
modified 5-Oct-12 10:20am.
|
|
|
|
|
Here is the code that prints very well:
void CSpscRichEditCtrl::Print(bool bShowPrintDialog, CWnd* pParent )
{
CPrintDialog printDialog(false, PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS
| PD_HIDEPRINTTOFILE | PD_NOSELECTION, pParent);
if (bShowPrintDialog)
{
int r = printDialog.DoModal();
if (r == IDCANCEL)
return; }
else
{
printDialog.GetDefaults();
}
HDC hPrinterDC = printDialog.GetPrinterDC();
FORMATRANGE fr;
int nHorizRes = GetDeviceCaps(hPrinterDC, HORZRES);
int nVertRes = GetDeviceCaps(hPrinterDC, VERTRES);
int nLogPixelsX = GetDeviceCaps(hPrinterDC, LOGPIXELSX);
int nLogPixelsY = GetDeviceCaps(hPrinterDC, LOGPIXELSY);
LONG lTextLength; LONG lTextPrinted;
SetMapMode ( hPrinterDC, MM_TEXT );
FormatRange(NULL,false);
ZeroMemory(&fr, sizeof(fr));
fr.hdc = fr.hdcTarget = hPrinterDC;
fr.rcPage.left = fr.rcPage.top = 0;
fr.rcPage.right = (nHorizRes/nLogPixelsX) * 1440;
fr.rcPage.bottom = (nVertRes/nLogPixelsY) * 1440;
fr.rc.left = fr.rcPage.left ; fr.rc.top = fr.rcPage.top ; fr.rc.right = fr.rcPage.right ; fr.rc.bottom = fr.rcPage.bottom ;
fr.chrg.cpMin = 0;
fr.chrg.cpMax = -1;
DOCINFO di;
ZeroMemory(&di, sizeof(di));
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = _T("eClinic Pharmacy SMS Authorisation Form");
di.lpszOutput = NULL;
StartDoc(hPrinterDC, &di);
lTextLength = GetTextLengthEx(GTL_PRECISE | GTL_NUMCHARS);
do
{
StartPage(hPrinterDC);
lTextPrinted =FormatRange(&fr,true);
DisplayBand(&fr.rc );
EndPage(hPrinterDC);
if (lTextPrinted < lTextLength)
{
fr.chrg.cpMin = lTextPrinted;
fr.chrg.cpMax = -1;
}
}
while (lTextPrinted < lTextLength);
FormatRange(NULL,false);
EndDoc (hPrinterDC);
DeleteDC(hPrinterDC);
}
|
|
|
|
|
Thank you Andrew,
The offending code was the
GetTextLength()
that it should be changed the way you showed me in your example with :
lTextLength = GetTextLengthEx(GTL_PRECISE | GTL_NUMCHARS);
I didn't bothered until now, with the GetTextLengthEx and I had a really hard time with this functionality. Now it works that way it should be.
MSDN reports :
GetTextLengthEx provides additional ways of determining the length of the text. It supports the Rich Edit 2.0 functionality. For more information, see About Rich Edit Controls in the Platform SDK.
My very best regards for your help,
George
sdancer75
|
|
|
|
|
Hi,
I am using H.264 codec to create MP4 file from images. IMFSinkWriter is used for encoding purpose.
While encoding, I need to control the quality of the encoded video by adjusting the average bit rate parameter value. But I could not get any equation for calculating this.
I tried several equations, but the video behavior is different for different type(resolution) of images.
One of the equation used is Frame width * Frame height * frame rate * Image quality parameter * some constant.
But this is not working for all types of resolutions.
My image quality parameter will be varied from 1 to 100.(Low to High)
Could you please provide an equation to calculate the average bit rate for controlling the image quality from Frame width, Frame height and frame rate?
I tried the VBR encoding but it does not work for the encoding using Sink writer.
|
|
|
|
|
I have a buffer which contains BitmapInfo + pixel data. this pixel data is in the palette format. Bitmapinfo structure contains color table. This can be solved by using LockBits method but I don't know how to use LockBits method for converting buffer to buffer. I found a lot of such conversions, but they are mainly processed one input file.
|
|
|
|
|
Here[^] you find how to reach the color table.
Pixel info follow the color table itself.
Veni, vidi, vici.
|
|
|
|
|
Hi have a good day,
Does any body manage to Build application using Dialog Resource for windows 64 bit ?
It Didn't Work for me , I get this error :
error C2664: 'DialogBoxParamW' : cannot convert parameter 4 from 'BOOL (__cdecl *)(HWND,UINT,WPARAM,LPARAM)' to 'DLGPROC'
I try to change
BOOL CALLBACK DialogProc to
INT_PTR CALLBACK DialogProc
But I still get ,
conversion from 'INT_PTR' to 'int', possible loss of data.
I also try to edit , winuser.h , From
typedef INT_PTR (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM);
To
typedef BOOL (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM);
But the Application Exit with out showing the dialog box ,
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
.
.
.
return true;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
hInst = hInstance;
return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, DialogProc);
}
P.S:
the code work perfectly when building for Win32.
Thank you.
|
|
|
|
|
Smart Arab wrote: I also try to edit , winuser.h , From That is a really bad idea. The windows API libraries have been tested extensively, and if you start changing them then you are likely to create far more problems than you will solve. The include file clearly shows you the format of your DLGPROC function, so it is up to you to create it to match that function definition; it returns an INT_PTR not a BOOL . You can also add a cast in your DialogBox() call to help the compiler along.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Smart Arab wrote: conversion from 'INT_PTR' to 'int', possible loss of data.
You should work on this, I suppose. Which line is giving you this message?
Veni, vidi, vici.
|
|
|
|
|