|
sir,
I have found the help for that and I am satisfy with this answer but could you guide me where should i write this function?
I mean in my Mainthread or the successive function call from the Mainthread.( )
suppose ,
e.g.
<br />
for(....)<br />
{<br />
hThread[i]=(HANDLE ) _beginthreadex(NULL, 0, &Thread, l, 0, &tid);<br />
}
here ????? where should I call and where should I defined ?
<br />
unsigned __stdcall Thread(void* pArguments )<br />
{ <br />
HRESULT hr=NULL;<br />
struct argument_list *Lparam= (argument_list *)pArguments ;<br />
Package pkg;<br />
static int threadID;<br />
threadID++; <br />
{<br />
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);<br />
}<br />
if(hr==S_OK)<br />
{ <br />
MessageBox(0,L"thread gone finished" ,L"therad",0);<br />
_endthreadex( 0 ); <br />
}<br />
<br />
<br />
threadID--; <br />
return 0;<br />
}
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Hi,
I am looking for windows api for finding out that
Whether a system is connected to Primary domain controller or its a local workstation?
If i am logged on to a domain controller i would like to know the domain name?
And if i am on a local machine then i would like to know about the computer name?
I tried GetComputerName but it doesn't give the domain controller Domain name in case of domain.
I want to somehow know if its on a domain or not??
Regards,
UI.
|
|
|
|
|
Dear umar cool,
Please find code for your question ....Thanks for giving me a good question to answer...
Senior guys... Please forgive me if I wrote a stupid code....
int EnumAllComputers()
{
LPSERVER_INFO_101 pBuf = NULL;
LPSERVER_INFO_101 pTmpBuf;
DWORD dwLevel = 101;
DWORD dwPrefMaxLen = MAX_PREFERRED_LENGTH;
DWORD dwEntriesRead = 0;
DWORD dwTotalEntries = 0;
DWORD dwTotalCount = 0;
DWORD dwServerType = SV_TYPE_SERVER; // all servers
DWORD dwResumeHandle = 0;
NET_API_STATUS nStatus;
LPTSTR pszServerName = NULL;
DWORD i;
//
// Call the NetServerEnum function to retrieve information
// for all servers, specifying information level 101.
//
nStatus = NetServerEnum((LPCSTR)pszServerName,
dwLevel,
(LPBYTE *) &pBuf,
dwPrefMaxLen,
&dwEntriesRead,
&dwTotalEntries,
dwServerType,
NULL,
&dwResumeHandle);
//
// If the call succeeds,
//
if ((nStatus == NERR_Success) || (nStatus == ERROR_MORE_DATA))
{
if ((pTmpBuf = pBuf) != NULL)
{
//
// Loop through the entries and
// print the data for all server types.
//
for (i = 0; i < dwEntriesRead; i++)
{
assert(pTmpBuf != NULL);
if (pTmpBuf == NULL)
{
fprintf(stderr, "An access violation has occurred\n");
break;
}
//printf("\tPlatform: %d\n", pTmpBuf->sv101_platform_id);
wprintf(L"\tName: %s\n", pTmpBuf->sv101_name);
//printf("\tVersion: %d.%d\n",
// pTmpBuf->sv101_version_major,
// pTmpBuf->sv101_version_minor);
printf("\tType: %d", pTmpBuf->sv101_type);
//
// Check to see if the server is a domain controller;
// if so, identify it as a PDC or a BDC.
//
/*SV_TYPE_WORKSTATION
SV_TYPE_SERVER
SV_TYPE_SQLSERVER
SV_TYPE_DOMAIN_CTRL
SV_TYPE_DOMAIN_BAKCTRL
SV_TYPE_TIME_SOURCE
SV_TYPE_AFP
SV_TYPE_NOVELL
SV_TYPE_DOMAIN_MEMBER
SV_TYPE_PRINTQ_SERVER
SV_TYPE_DIALIN_SERVER
SV_TYPE_XENIX_SERVER
SV_TYPE_SERVER_UNIX
SV_TYPE_NT
SV_TYPE_WFW
SV_TYPE_SERVER_MFPN
SV_TYPE_SERVER_NT
SV_TYPE_POTENTIAL_BROWSER
SV_TYPE_BACKUP_BROWSER
SV_TYPE_MASTER_BROWSER
SV_TYPE_DOMAIN_MASTER
SV_TYPE_SERVER_OSF
SV_TYPE_SERVER_VMS
SV_TYPE_WINDOWS
SV_TYPE_DFS
SV_TYPE_CLUSTER_NT
SV_TYPE_TERMINALSERVER
SV_TYPE_CLUSTER_VS_NT
SV_TYPE_DCE
SV_TYPE_ALTERNATE_XPORT
SV_TYPE_LOCAL_LIST_ONLY
SV_TYPE_DOMAIN_ENUM */
if (pTmpBuf->sv101_type & SV_TYPE_DOMAIN_CTRL)
{
wprintf(L" (PDC)");
}
if (pTmpBuf->sv101_type & SV_TYPE_DOMAIN_BAKCTRL)
{
wprintf(L" (BDC)");
}
if(pTmpBuf->sv101_type & SV_TYPE_WORKSTATION)
{
wprintf(L" (WS)");
}
wprintf(L"\tComment: %s\n\n", pTmpBuf->sv101_comment);
printf("\n");
//
// Also print the comment associated with the server.
//
pTmpBuf++;
dwTotalCount++;
}
// Display a warning if all available entries were
// not enumerated, print the number actually
// enumerated, and the total number available.
if (nStatus == ERROR_MORE_DATA)
{
fprintf(stderr, "\nMore entries available!!!\n");
fprintf(stderr, "Total entries: %d", dwTotalEntries);
}
printf("\nEntries enumerated: %d\n", dwTotalCount);
}
}
else
fprintf(stderr, "A system error has occurred: %d\n", nStatus);
//
// Free the allocated buffer.
//
if (pBuf != NULL)
NetApiBufferFree(pBuf);
return 0;
}
|
|
|
|
|
Hi All
i want to get ID of controls used in CommonDlg box used. For exp i want ID of Open File text used in FileOpen Dlg box.Because i want to change font of all controls used in FileOpen Dlg box,so for this i required ID of controls.
Thanks in Advance
Atool
|
|
|
|
|
M. Atul wrote: i want to get ID of controls used in CommonDlg box used.
Those are in dlgs.h .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
is it right to say that preprocessor directives is
#include<iostream.h>
and
preprocessor is a character
#
|
|
|
|
|
The preprocessor is a program that takes a source file and does things to it before the compiler sees the file. Directives are instructions to the preprocessor telling it what to do. More info here: clickety[^]
|
|
|
|
|
Hi
Does anyone know how to prevent self assignment of object.
E.g If I have a class A,
A a;
a = a; // how to prevent this
|
|
|
|
|
|
ragavan wrote: a = a; // how to prevent this
What do you mean "prevent"? You want a compiler error?
If you just don't want the assignment to happen you can create an assignment operator and check if the right hand side value s address == this and do not perform the assignment.
led mike
|
|
|
|
|
You probably also want to prevent the copy constructor. I guess your question is regarding manual memory management, classes that handle memory/resources might need a decent copy constructor and an assignment operator (or alternatively a prevention of shallow copy).
For details please see boost::noncopyable and the Law of the Big Two.
In my class designs I sometimes take the easy way and just use 'noncopy' to prevent the shallow copy (which also means users can't make a copy of the objects, which really is fine for some classes). But sometimes you actually want this feature and then I implement both copy contructor and assignment operator (with a check for accidental self assignment).
Hope it helps,
M
|
|
|
|
|
Hi all
I posted a message days before when I got an error message " program too big to fit in memory " while executing a binary . When I ran depends.exe on the problematic exe to my surprise I found that "at least one of the files are not Win32" ! . A quick question to my collegue who asked me to run this exe confirmed that he had sent me an exe intended for linux environment !
My question is : why did not I get a direct message like "non windows exe" or something like that ?
Why this "too big to fit in memory" message which misled me to beleive I might have some RAM issue/page file issue etc ...?
redindian
|
|
|
|
|
Well, if the exe is win32, it will run, and try to use the other files that were provided with it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi christian
My question is , Why not MS provide us with a valid message instead of misleading one that points to a memory issue ?
redindian
|
|
|
|
|
Your question makes no sense. MS is not misleading you at all. They are running the exe you have provided, it's trying to read the files that came with it, and failing to do so. If I put datsun parts in my ferrarri, is it the ferrarri's fault if it doesn't know how to use them ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
dharani wrote: My question is : why did not I get a direct message like "non windows exe" or something like that ?
Because windows would expect this module to be in the PE format. I guess that somewhere in the PE header there would be a field indicating the amount of memory needed to load and run the module. The file you have probably has some huge number at this offset that windows is interpreting as the memory size required.
|
|
|
|
|
i need to write these commands only and run:
#include<stdio.h>
main()
{
printf("Hello\n");
}
A step by step tutorial on Visual Studio 2005 please...
Dont need other libraries such stdafx.h and other code such :
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
Just want to run the command above without any errors just i did in my lesson ,but in Visual Studio 6
Thanks
|
|
|
|
|
Do what I said to do before - go to File/New/Project. Select Visual C++/Win32.
Now create a Win32 Project. Enter a name and click OK. Now click on 'Application Settings' and choose 'console application' Deselect precompiled header and choose 'empty project'
Now right click on the project name in the solution explorer and choose add/new item. Click on 'code' and C++ file. Type in main.c, and click OK. Put your code in, and VC++ will know it's a C project, and it iwll compile and run just fine.
The one thing is, the app will not pause for you to see the output, you need to add a line to read text, or set a break point, in order for the window to not open and close again right away.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
That's what i mean a tutorial!
But i am stupid...
I doubled clicked in the end of the code and Click On Insert a breakpoint. Nothing apears,like a console,when i click compile!
what should i do??
Do you know the code for something like this ??
*
**
***
****
Until ten asterisks ?
Thanks a lot man! you are great!
|
|
|
|
|
WakenDJ wrote: Click On Insert a breakpoint. Nothing apears,like a console,when i click compile!
Inserting a break point will just put a dot there, it won't do anythng until you run it, and only then if it's within the code that gets run.
WakenDJ wrote: Do you know the code for something like this ??
*
**
***
****
Until ten asterisks ?
Yes, but that would be a homework question. What do you think the answer would be ? I'd do it using a nested loop.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I finally ran that damn Hello World! i am proud ! lol
Yep this is an exercise for today in my class... Can you tell me the way if it is ok please?
is there any specific place i should put that breakpoint,cause after the console apears ,it stucks and i have to close is through the task manager
|
|
|
|
|
You'd do better to add a line that reads input from the console. The point of a breakpoint, is that the program stops and you can examine variables and start it again.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I added a scanf before printf and added a breakpoint a step back of } .. it works great but why the console stucks there and no responding?do you think it is a Visual Studio problem ?
|
|
|
|
|
No, the console gets stuck because that is what a breakpoint is for. You need to add a line AFTER the printf, if you want the program to stop and let you see the printf output.
Regarding your assignment, what you need to do is have two loops, that's called a nested loop. One loop controls the number of lines you print, the other loop prints the number of #s in the line. Have you covered for loops in class ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
A half an hour about FOR and a statement about do while,nothing more.
I think you didnt get me.My english are not so good.
I added a breakpoint after printf just like this:
#include<stdio.h>
main()
{
int a;
scanf("%d",&a);
printf("Hello\n");
BREAKPOINT
}
I mean not responding.I have to press CTRL + ALT + DEL to close it from there.
That this happens with the breakpoint embedded.Without it it works great but i cannot see the printf.With it i can but it crushes!i finally found the word i need!
Can you please tell me the code about that program with the asterisks? with do...while at least.It is too difficult to find it out.
|
|
|
|