|
Hi
I need to use a flexgrid in which i will be able to enter only Hexadecimal characters
from 0 - 9 and A - F (Capital letters only),which proprty should i use here in this case. Also i have to resize the column by clicking in the border of two columns heading just as we do in windows.
Please provide the comments.
modified on Saturday, February 21, 2009 9:46 AM
|
|
|
|
|
Hi,
I have developed program in which I am creating window.I want to maximize window size before its creation.Can anyone suggest me.
Rekha.
|
|
|
|
|
Override the PreCreateWindow method in the main window class.
Add the WS_MAXIMIZE style to the style member of the CREATESTRUCT parameter like so.
cs.style |= WS_MAXIMIZE
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
I have overriden PreCreateWindow like this.But I am unable to create maximized window.
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style &= ~FWS_ADDTOTITLE;
cs.style |= WS_MAXIMIZE;
return TRUE;
}
|
|
|
|
|
If you want to maximize the window call ShowWindow() with SW_MAXIMIZE . Take a look at the docs here.
Regards,
--Perspx
|
|
|
|
|
Hi,
I used ShowWindow(SW_MAXIMIZE) in PreCreateWindow function like this.But I
am unable to create maximized window.
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
f( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.style &= ~FWS_ADDTOTITLE;
ShowWindow(SW_MAXIMIZE);
return TRUE;
}
|
|
|
|
|
Hi,
I am able to create maximized window.I added ShowWindow(SW_MAXIMIZE) in OnCreate function.Thanks for your reply
|
|
|
|
|
Hello,
How can I get the status of a service (Running, Stopped, etc) in
a remote machine. I've the domain (of the remote machine) username
and password.
I need to get the status programmatically without using any tool.
FYI : I'm using VC 6.0
Thanks in advance
|
|
|
|
|
You can give the remote machine name in the first parameter of OpenSCManager function.
Then use the QueryServiceStatusEx function to get the status of the service.
To impersonate another user you can use LogonUser and ImpersonateLoggedOnUser APIs.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for the info. I'll try those.
|
|
|
|
|
Using Following code Device Enumerator is Not Successful Created and Showing Message of "Error Creating Device Enumerator"
HRESULT hr;
ICreateDevEnum *pSysDevEnum = NULL;
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,IID_ICreateDevEnum, (void **)&pSysDevEnum);
if (SUCCEEDED(hr))
{
MessageBox("Succeded");
}
if (hr != S_OK)
{
MessageBox(TEXT("Error Creating Device Enumerator"));
return ;
}
Plz Suggest some Solution To Resolve this Problem
|
|
|
|
|
Using
HRESULT hr = CoInitialize(NULL);
Statement before Creating Enumerator Initialized Com library and Solved Problem.........
|
|
|
|
|
Following to my question yesterday, is there anything that can be done to clean up the c code below which works fine but looks ugly especially the strcat's? The program parses a file containing a list of files and then runs a command on each. I can do a similar thing in perl like this a couple of lines but in C its looks ugly and I think its because I am a newbie...any comments will be appreciated....
thanks in advance for everyones help
In perl:
#!/usr/bin/perl
while(<>){
chomp;
$cmd="qsub -P 9999 -wd -e $_\.error -b y /usr/local/projects/bin/program -i $_ -type p -terms -lookup -o $_\.qsub";
print "$cmd\n";
}
in C:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
char * cwd = getcwd(0,0);
char pro[10000];
char str[1000];
char* nl;
if (argc < 3) {
printf("\n\nPlease supply a file containing a list of single file names follow by project code\n");
exit(5);
}
FILE *f;
f = fopen(argv[1], "r");
if(!f) {
printf("Couldn't open file.txtn");
return 1;
}
while(fgets(str, 1000, f)) {
nl = strrchr(str, '\r');
if (nl) *nl = '\0';
nl = strrchr(str, '\n');
if (nl) *nl = '\0';
strcpy(pro, "qsub -P ");
strcat(pro, argv[2]);
strcat(pro, " -wd -e ");
strcat(pro, cwd);
strcat(pro, "/");
strcat(pro, str);
strcat(pro, ".error -b y /usr/local/projects/bin/program -i ");
strcat(pro, cwd);
strcat(pro, "/");
strcat(pro, str);
strcat(pro, " -type p -terms -lookup -o ");
strcat(pro, str);
strcat(pro, ".qsub");
printf (pro);
system(pro);
}
}
|
|
|
|
|
Hi,
why don't you use sprintf() to compute the entire string?
it works similar to printf() but outputs to a char buffer.
FYI: More modern languages support string objects and do simple concatenation, much like ancient Basic: string c = a + b;
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
You should really use sprintf() instead of strcpy and strcat, it will look something like this:
sprintf(pro, "%s%s%s%s%c%s%s%s%c%s%s%s%s",
"qsub -P ",
argv[2],
" -wd -e ",
cwd, '/',
str,
".error -b y /usr/local/projects/bin/program -i ",
cwd,
'/',
str,
" -type p -terms -lookup -o ",
str,
".qsub");
after this call pro[] buffer contains formatted string
And few remarks about your code safety:
be careful with creating huge local buffers on the stuck - pro[] buffer in this case. It may happen that you get stuck overflow (application crush) It is better to create such buffers dynamically then you can check if allocation succeeded or just create static buffer
use sizeof(str) in fgets(str, sizeof(str), f) to avoid problems with writing outsie str[] memory area when str[] buffer size will be changed to smaller one
|
|
|
|
|
Thank you so much grzkas!
|
|
|
|
|
One little (possible) improvement to the original answer - the literal strings can be embedded in the sprintf format string, as shown below. It's a bit more like variable interpolation in strings, a la Perl.
sprintf(pro, "qsub -P %s -wd -e %s/%s.error -b y /usr/local/projects/bin/program -i %s/%s -type p -terms -lookup -o %s.qsub",
argv[2],
cwd,
str,
cwd,
str,
str);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks Stuart, very useful..
|
|
|
|
|
hi all...as a part of my project...i need to send an mp3 file to another sys..i've created packet but i hv no idea abt how to place that mp3/pcm as payload..since the maximum size of ethernet frame payload is 1500 bytes, do i have to do sampling?..can anyone help me out with this??? thanks...
|
|
|
|
|
Can you explain how/why you are dealing with ethernet frames?
|
|
|
|
|
hi..actually what i've to do is to create a layer 2 (Datalink layer) protocol for streaming mp3/any audio file to another system in intranet(LAN)..for that i'm using winpcap for sending packets...how to place mp3 payload in that??
|
|
|
|
|
septane wrote: since the maximum size of ethernet frame payload is 1500 bytes
At the application layer you needn't worry about the ethernet payload.
The splitting will be done at lower layers.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi.
I have a c# DLL, and I want to use it in a c/c++ project.
I'm using LoadLibrary() and GetProcAddress(). I have a problem when I want to use GetProcAddress() because, I don't know how to call the method that I want...
For example I know that the c# code has:
class myClass
public void myMethod1()
public void myMethod2()
and using the DLL I want to call 'myMethod2()'.
Anyone knows how can I do it?
Because if I do GetProcAddress(myDll,"myMethod2") it doesn't work (I call GetLastError() and it says that error is type 127)...
Thanks.
|
|
|
|
|
Member Ártemis wrote: ...(I call GetLastError() and it says that error is type 127)...
Which resolves to ERROR_PROC_NOT_FOUND . Have you used Dumpbin.exe or Depends.exe to see the names of the exported functions in the DLL?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
No, I didn't...
But is it possible to use c# DLL in c/c++ projects, I ask this because I know that we can use c/c++ DLL in c#, but the otherwise I never tried?
I made the c# DLL myself, and I know the methods names. When compile the DLL methods names change?
Probably, these are stupid questions, but I'm trying to learn.
Thanks
|
|
|
|