NO

Recent Posts

Pages: [1] 2 3 ... 10
1
User contributions / Re: WTypeLibList
« Last post by TimoVJL on June 26, 2017, 06:46:38 PM »
I just updated code again for Pelle's nice code for COM interface. (WTypeLibList3_WS_a1.zip)

So why download a huge SDK for a small header file, when we can have a good typelib, that gives you most of details for a header file?

I hope that people inform us about dll/ocx where we can find useful info.
Don't forget FTypeLib

BTW:
This way i give something back to Pelle to his great work.
Sure i have also given some with PayPal too ;)

EDIT:
qedit.h needs additional fixes:
rename _PinDirection to PIN_DIRECTION
rename _AMMediaType to AM_MEDIA_TYPE
 comment out between
Code: [Select]
/*
typedef struct _LARGE_INTEGER {
...
} _FILETIME;
*/
2
User contributions / Re: WTypeLibList
« Last post by jj2007 on June 23, 2017, 01:11:22 AM »
What's going on, Timo? A revival of DirectShow??  ;)
3
User contributions / WTypeLibList
« Last post by TimoVJL on June 22, 2017, 04:27:32 PM »
Updated version of WTypeLibList.
  • enums are moved to second after forward declarations in header file
  • struct GUID is saved as GUID
  • option to correct GUID in QueryInterface to REFIID
these modifications was for typelib like in a quartz.dll

test program for headers
Code: [Select]
#define WIN32_LEAN_AND_MEAN
//#include <dshow.h>
#include <ole2.h>
#include "quartz.h"
#include "qedit.h"
#pragma comment(lib, "ole32.lib")
// http://doc.51windows.net/Directx9_SDK/?url=/Directx9_SDK/htm/imsvidctlinterface.htm
const GUID CLSID_FilterGraph = {0xe436ebb3,0x524f,0x11ce,{0x9f,0x53,0x0,0x20,0xaf,0xb,0xa7,0x70}};
const GUID IID_IGraphBuilder = {0x56a868a9,0xad4,0x11ce,{0xb0,0x3a,0x0,0x20,0xaf,0xb,0xa7,0x70}};
const GUID IID_IMediaControl = {0x56a868b1,0xad4,0x11ce,{0xb0,0x3a,0x0,0x20,0xaf,0xb,0xa7,0x70}};
const GUID IID_IMediaEvent = {0x56a868b6,0x0ad4,0x11ce,{0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70}};

int main(void)
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL;
// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
// Create the filter graph manager and query for interfaces.
hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (void **)&pGraph);
if (pGraph)
{
hr = pGraph->lpVtbl->QueryInterface(pGraph, &IID_IMediaControl, (void **)&pControl);
hr = pGraph->lpVtbl->QueryInterface(pGraph, &IID_IMediaEvent, (void **)&pEvent);
// Build the graph. IMPORTANT: Change this string to a file on your system.
hr = pGraph->lpVtbl->RenderFile(pGraph, L"video.avi", NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->lpVtbl->Run(pControl);
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->lpVtbl->WaitForCompletion(pEvent, INFINITE, &evCode);
// Note: Do not use INFINITE in a real application, because it
// can block indefinitely.
}
}
pEvent->lpVtbl->Release(pEvent);
pControl->lpVtbl->Release(pControl);
pGraph->lpVtbl->Release(pGraph);
}
CoUninitialize();
return 0;
}
4
Beginner questions / Re: _wmakepath returns incomplete string
« Last post by sgraffe on June 21, 2017, 02:46:19 PM »
Thank you, Timo.

I was not aware of the stream orientation. Maybe wprintf should have a reference to the topic.

Compiler 2, user 1 :-)

PS.
 I was checking an example from Microsoft, and they do not use fwide. The switch beteeen printf and wprintf without problem. It seems that their compiler handles differently the orientation of the stream.

Regards,
5
Windows questions / Re: How to list all members in an AD group
« Last post by liut on June 21, 2017, 09:44:57 AM »
Finally I spent almost a day to find out the way based on Win7 SDK documents. I have to use ADSI interface with LDAP path name to complete the complicated operation...

Code: [Select]
#define UNICODE

#include <stdio.h>
#include <wchar.h>
#include <iads.h>
#include <adshlp.h>

#pragma comment(lib,"Ole32.lib")
#pragma comment(lib,"Oleaut32.lib")
#pragma comment(lib,"Activeds.lib")

const IID iads={0xfd8256d0,0xfd15,0x11ce,{0xab,0xc4,0x02,0x60,0x8c,0x9e,0x75,0x53}};
const IID iads_group={0x27636b00,0x410f,0x11cf,{0xb1,0xff,0x02,0x60,0x8c,0x9e,0x75,0x53}};  // 27636b00-410f-11cf-b1ff-02608c9e7553
const IID iads_members={0x451a0030,0x72ec,0x11cf,{0xb0,0x3b,0x00,0xaa,0x00,0x6e,0x09,0x75}};  // 451a0030-72ec-11cf-b03b-00aa006e0975
const IID iid_enumvariant={0x00020404,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};  // 00020404-0000-0000-C000-000000000046

void enum_members(IADsMembers *p_members)
{
IUnknown *p_unknown;

HRESULT hr0,hr1,hr2;

hr0=p_members->lpVtbl->get__NewEnum(p_members,&p_unknown);
if(hr0!=S_OK){
wprintf(L"2.0 Err=%08X\n",hr0);
}
else{
IEnumVARIANT *p_enum;

hr1=p_unknown->lpVtbl->QueryInterface(p_unknown,&iid_enumvariant,(void **)&p_enum);
if(hr1!=S_OK){
wprintf(L"2.1 Err=%08X\n",hr1);
}
else{
ULONG fetch;
VARIANT var;

VariantInit(&var);
hr2=p_enum->lpVtbl->Next(p_enum,1,&var,&fetch);
if(hr2!=S_OK){
wprintf(L"2.2 Err=%08X\n",hr2);
}
else{
int i=1;

while(hr2==S_OK){
IDispatch *p_disp;

if(fetch==1){
IADs *p_ads;

p_disp=V_DISPATCH(&var);
if(p_disp){
p_disp->lpVtbl->QueryInterface(p_disp,&iads,(void **)&p_ads);

if(p_ads){
BSTR str;
wchar_t member_name[100],member_class[100];

p_ads->lpVtbl->get_Name(p_ads,&str);
if(wcslen(str)<=100) wcscpy(member_name,str+3);  // Don't copy "CN="
SysFreeString(str);

p_ads->lpVtbl->get_Class(p_ads,&str);
if(wcslen(str)<=100) wcscpy(member_class,str);
SysFreeString(str);

wprintf(L"Member %d: %ls (%ls)\n",i++,member_name,member_class);

SysFreeString(str);

p_ads->lpVtbl->Release(p_ads);
}

p_disp->lpVtbl->Release(p_disp);
}
}

VariantClear(&var);
p_disp=NULL;

hr2=p_enum->lpVtbl->Next(p_enum,1,&var,&fetch);
}
}

p_enum->lpVtbl->Release(p_enum);
}

p_unknown->lpVtbl->Release(p_unknown);
}
}

int wmain(int argc,wchar_t *argv[])
{
// Initialize COM.
CoInitialize(NULL);

wchar_t *group_ldap_name=L"LDAP://CN=xxx,OU=xxx,DC=xxx,DC=xxx";

HRESULT hr0,hr1;
IADsGroup *p_group;

hr0=ADsGetObject(group_ldap_name,&iads_group,(void **)&p_group);
if(hr0!=S_OK){
wprintf(L"0. Err=%08X\n",hr0);
}
else{
IADsMembers *p_members;

hr1=p_group->lpVtbl->Members(p_group,&p_members);
if(hr1!=S_OK){
wprintf(L"1. Err=%08X\n",hr1);
}
else{
enum_members(p_members);

p_members->lpVtbl->Release(p_members);
}

p_group->lpVtbl->Release(p_group);
}

// Uninitialize COM.
CoUninitialize();

return 0;
}
6
Beginner questions / Re: _wmakepath returns incomplete string
« Last post by TimoVJL on June 21, 2017, 07:30:47 AM »
Not a bug. Each stream has an orientation: byte-oriented or wide-oriented. See fwide().
7
Beginner questions / Re: _wmakepath returns incomplete string
« Last post by sgraffe on June 20, 2017, 09:30:40 PM »
Hello again:

I modified my sample program, and changed the last line to use wprintf instead of printf:
Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>

int main(void)
{
char path [FILENAME_MAX];
char drive[] = "C:";
char dir  [] = "\\foldername\\";
char name [] = "filename";
char ext  [] = "txt";

_makepath(path, drive, dir, name, ext);
printf("%s \n", path);

wchar_t wpath [FILENAME_MAX];
wchar_t wdrive[] = L"C:";
wchar_t wdir  [] = L"\\foldername\\";
wchar_t wname [] = L"filename";
wchar_t wext  [] = L"txt";

_wmakepath(wpath, wdrive, wdir, wname, wext);
wprintf(L"%ls \n", wpath);

return 0;
}

now wprintf does not give any output. The output for the program is just
C:\foldername\filename.txt  (the printf at the beginning)

so, is the handling of wchar_t type not reliable?
 
8
Bug reports / _wmakepath returns incorrect result
« Last post by sgraffe on June 20, 2017, 02:06:28 PM »
Hello All:
I am not getting correct result from function _wmakepath. The following program demonstrate output from functions _makepath and _wmakepath.
Code: [Select]
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
   char path [FILENAME_MAX];
   char drive[] = "C:";
   char dir  [] = "\\foldername\\";
   char name [] = "filename";
   char ext  [] = "txt";

   _makepath(path, drive, dir, name, ext);
   printf("%s \n", path);

   wchar_t wpath [FILENAME_MAX];
   wchar_t wdrive[] = L"C:";
   wchar_t wdir  [] = L"\\foldername\\";
   wchar_t wname [] = L"filename";
   wchar_t wext  [] = L"txt";

   _wmakepath(wpath, wdrive, wdir, wname, wext);
   printf("%ls \n", wpath);

   return 0;
}
Output:
C:\foldername\filename.txt    (from _makepath)
C:\foldername\                       (from _wmakepath)

Output from _wmakepath is missing the filename and extension components.
Compiler options are: -std:C11 -Tx86-coff -Ot -Ob1 -fp:precise -W1 -Gd -Zx
Version: 8.00.60 (Win64)

TimoVJL produced a fix for this bug in
http://forum.pellesc.de/index.php?topic=7162.msg27173#msg27173
Regards,
9
Beginner questions / Re: _wmakepath returns incomplete string
« Last post by TimoVJL on June 20, 2017, 01:19:14 PM »
Sure you can do it.

In attachment a test project to fix that wmakepath bug if someone want to replace it in crt.lib.
10
Beginner questions / Re: _wmakepath returns incomplete string
« Last post by sgraffe on June 20, 2017, 12:57:09 PM »
Oh, thank you, Timo. Shall I copy this message to the Bugs section?

Compiler 1, User 1, :-).

Regards,
Pages: [1] 2 3 ... 10