|
Hi!
I'm looking for a way to make a bitmap that is already displayed in the dialog become transparent, when a button is clicked and vice-versa..
or just make it disappear and then make it appear again just in the same place..
is that possible? can you help me please?
|
|
|
|
|
Praystation2 wrote: make a bitmap that is already displayed in the dialog
How is the bitmap displayed?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
the bitmap is loaded when the dialog is initialized, but is defined as not visible, and i want to make it visible when i click a button.
i don't know if it's the best way since i'm a beginner in using MFC.
the point is to make it appear and disappear using a button, but it needs to start invisible
(sorry about my english)
|
|
|
|
|
Praystation2 wrote: bitmap is loaded
Into a control on the dialog?
If so, then one of CWnd::ShowWindow[^] (if you have a variable for the control) or ShowWindow[^] (if you just have a control ID) should be what you want.
Call the appropriate one with the nCmdShow parameter set to SW_SHOW or SW_HIDE to show/hide the bitmap's window.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I'm using a picture control and it's ID is IDC_casa_luz.
can you give the code i should use inside the button function to make it appear/disappear?
|
|
|
|
|
Praystation2 wrote: can you give the code
//Disappear
GetDlgItem(IDC_casa_luz)->ShowWindow(SW_HIDE);
//Appear
GetDlgItem(IDC_casa_luz)->ShowWindow(SW_SHOW);
|
|
|
|
|
thanks thanks thanks thanks thanks thanks!!!!!
|
|
|
|
|
Praystation2 wrote: can you give the code i should use inside the button function to make it appear/disappear?
What Madhu[^] said
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i am writing a milter which decrypts the email message.
For decryption i am using GMP library...
The code which gives the error is as follows:
mpz_t bigbody,encbody,decbody,n,d,e;
mpz_init_set_str (e, "5", 10);
mpz_init_set_str (n, "81072118814004638617775947138239917744589505176471539666269773100315781097546894455560658571445286325125766632676152452856383447352821337178984474781813475276075048299705214136395672502245955793627681061360075723595075874516950614187016991430293887968216015097675955399134514678660046996064181098182893072761", 10);
mpz_init_set_str (d, "32428847525601855447110378855295967097835802070588615866507909240126312439018757782224263428578114530050306653070460981142553378941128534871593789912725382636961637010791821646038659077539848411532121133465246631106852802485583932352673149866783600963924490576147444236696494852521901563664557493382382127469", 10);
char *STR;
STR=(char*)malloc(1000);
mpz_t array[10];
//mpz_array_init (array, 10, 308);
mpz_t array1[10];
//mpz_array_init (array1, 10, 100000);
char substring[400];
int i=0,lower=0,upper=308;
while(i<noofblocks)
{
="" strncpy(substring,="" data_buffer="" +="" lower,="" upper);
="" *(substring+308)="\0" ;
="" syslog(="" log_info,="" "conn#="" %d="" -="" substring="%s"," cd-="">connection_num, substring );
lower=upper;
upper=upper+308;
mpz_init_set_str(array[i],substring,10);
mpz_get_str (STR, 10, array[i]);
strcat(STR,"\0");
syslog( LOG_INFO, "conn# %d - Encrypted-Biginteger = %s", cd->connection_num, STR );
mpz_init(array1[i]);
mpz_powm (array1[i], array[i], d, n);
mpz_get_str (STR, 10, array1[i]);
syslog( LOG_INFO, "conn# %d - Decrypted-Biginteger = %s", cd->connection_num, STR );
size_t length;
void *ret;
char *decrypted;
decrypted=(char*)malloc(1000);
ret=mpz_export (decrypted, &length, 1,sizeof(data_buffer[0]), 0, 0, array1[i]);
//ret=mpz_export (decrypted, &length, 1,sizeof(data_buffer[0]), 0, 0, array1[i]);
strncpy(decrypted,ret,length);
*(decrypted+length)='\0';
syslog( LOG_INFO, "conn# %d - size decrypted = %d Decrypted = %s", cd->connection_num,length, (char *)ret );
fflush(stdout);
free(decrypted);
fflush(stdin);
mpz_clear(array[i]);
mpz_clear(array1[i]);
i++;
}
This code executes for 2 iterations and then give segmentation fault at mpz_powm( )
|
|
|
|
|
shrims4u wrote: ...then give segmentation fault at mpz_powm( )
What are the values of array1[i] , array[i] , d , and n at that point?
"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
|
|
|
|
|
the value of array[i] is a bignumber....
Also d and n are initialised...
The error is at mpz_powm....
you want me to write the values in numbers????
Actually it differs each time according to the message
|
|
|
|
|
My, point, although subtle, was to ensure that the values you are passing to that function are valid. Some functions/libraries place the onus of validation solely on the caller (rather than handle the bad input and fail gracefully)
"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
|
|
|
|
|
yah the values that are passed are proper...
The gdb output is as follows....
[New Thread -1208882288 (LWP 9012)]
[New Thread -1208879424 (LWP 9009)]
[New Thread -1219372144 (LWP 9017)]
GNU MP: Cannot allocate memory (size=3368600780)
Program received signal SIGABRT, Aborted.
[Switching to Thread -1219372144 (LWP 9017)]
0x00110402 in __kernel_vsyscall ()
|
|
|
|
|
shrims4u wrote: GNU MP: Cannot allocate memory (size=3368600780)
I would guess that this is related to the problem. It's tried to allocate 3 Gb of memory, and failed...
As to why it's trying to allocate such a big chunk of memory, I couldn't say, but maybe stepping through until you get that error might help pin it down.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
ill mail the whole program to uall
Actually it is a milter which decrypts the incoming mail messages...
<br />
<br />
<br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include <unistd.h><br />
#include <string.h><br />
#include <pthread.h><br />
#include <syslog.h><br />
#include <sys/types.h><br />
#include <sys/socket.h><br />
#include <netinet/in.h><br />
#include <arpa/inet.h><br />
#include <sys/stat.h><br />
#include <fcntl.h><br />
<br />
#include <glib.h><br />
#include <gmime/gmime.h><br />
<br />
#include "libmilter/mfapi.h"<br />
<br />
#include "gmp.h"<br />
<br />
<br />
<br />
<br />
static void usage( void );<br />
static sfsistat sample_connect( SMFICTX* ctx, char* connhost, _SOCK_ADDR* connaddr );<br />
static sfsistat sample_helo( SMFICTX* ctx, char* helohost );<br />
static sfsistat sample_envfrom( SMFICTX* ctx, char** fromargs );<br />
static sfsistat sample_envrcpt( SMFICTX* ctx, char** rcptargs );<br />
static sfsistat sample_header( SMFICTX* ctx, char* name, char* value );<br />
static sfsistat sample_eoh( SMFICTX* ctx );<br />
static sfsistat sample_body( SMFICTX* ctx, unsigned char* bytes, size_t len );<br />
static sfsistat sample_eom( SMFICTX* ctx );<br />
static sfsistat sample_abort( SMFICTX* ctx );<br />
static sfsistat sample_close( SMFICTX* ctx );<br />
static void thread_data_destructor( void* data );<br />
<br />
int smfi_replacebody(<br />
SMFICTX *ctx,<br />
unsigned char *bodyp,<br />
int bodylen<br />
);<br />
<br />
<br />
int smfi_chgheader(<br />
SMFICTX *ctx,<br />
char *name,<br />
int hdridx,<br />
char *value<br />
);<br />
<br />
<br />
<br />
<br />
static char* argv0;<br />
static pthread_key_t key;<br />
static int connections;<br />
static char* data_buffer, *contentTypeBuffer;<br />
void *ret;
size_t size;<br />
int flag=0;<br />
<br />
GMimeMessage *message;<br />
GMimeStream *stream;<br />
GMimeParser *parser;<br />
GMimeMultipart *multipart;<br />
GMimePart *mime_part,*mime_part0;<br />
GMimeContentType *contentType,*contentType1;<br />
<br />
static struct smfiDesc smfilter =<br />
{<br />
"SAMPLE", <br />
SMFI_VERSION, <br />
SMFIF_CHGBODY | SMFIF_CHGHDRS, <br />
sample_connect, <br />
sample_helo, <br />
sample_envfrom, <br />
sample_envrcpt, <br />
sample_header, <br />
sample_eoh, <br />
sample_body, <br />
sample_eom, <br />
sample_abort, <br />
sample_close <br />
};<br />
<br />
<br />
int<br />
main( int argc, char** argv )<br />
{<br />
char* sockarg;<br />
<br />
<br />
<br />
g_mime_init (0);<br />
<br />
message = g_mime_message_new(FALSE);<br />
<br />
<br />
argv0 = strrchr( argv[0], '/' );<br />
if ( argv0 != (char*) 0 )<br />
++argv0;<br />
else<br />
argv0 = argv[0];<br />
<br />
connections = 0;<br />
<br />
if ( argc != 2 )<br />
usage();<br />
sockarg = argv[1];<br />
<br />
if ( pthread_key_create( &key, &thread_data_destructor ) )<br />
{<br />
perror( "pthread_key_create" );<br />
exit( 1 );<br />
}<br />
<br />
openlog( argv0, 0, LOG_MAIL );<br />
<br />
(void) smfi_setconn( sockarg );<br />
if ( smfi_register( smfilter ) == MI_FAILURE )<br />
{<br />
(void) fprintf( stderr, "%s: register failed\n", argv0 );<br />
exit( 1 );<br />
}<br />
if ( smfi_main() == MI_FAILURE )<br />
{<br />
(void) fprintf( stderr, "%s: milter failed\n", argv0 );<br />
exit( 1 );<br />
}<br />
<br />
syslog( LOG_INFO, "exitting - %d connections", connections );<br />
(void) pthread_key_delete( key );<br />
closelog();<br />
<br />
<br />
exit( 0 );<br />
}<br />
<br />
<br />
static void<br />
usage( void )<br />
{<br />
(void) fprintf( stderr, "usage: %s socket\n", argv0 );<br />
exit( 1 );<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
struct thread_data {<br />
int junk;<br />
};<br />
<br />
<br />
struct connection_data {<br />
int connection_num;<br />
int messages;<br />
int recipients;<br />
int headers;<br />
int bodyblocks;<br />
size_t bodybytes;<br />
int aborts;<br />
};<br />
<br />
<br />
<br />
static sfsistat<br />
sample_connect( SMFICTX* ctx, char* connhost, _SOCK_ADDR* connaddr )<br />
{<br />
struct thread_data* td;<br />
struct connection_data* cd;<br />
struct sockaddr_in* sin;<br />
<br />
td = (struct thread_data*) pthread_getspecific( key );<br />
if ( td == (struct thread_data*) 0 )<br />
{<br />
td = (struct thread_data*) malloc( sizeof(struct thread_data) );<br />
if ( td == (struct thread_data*) 0 )<br />
return SMFIS_TEMPFAIL;<br />
if ( pthread_setspecific( key, (void*) td ) )<br />
{<br />
free( (void*) td );<br />
return SMFIS_TEMPFAIL;<br />
}<br />
}<br />
<br />
cd = (struct connection_data*) malloc( sizeof(struct connection_data) );<br />
if ( cd == (struct connection_data*) 0 )<br />
return SMFIS_TEMPFAIL;<br />
(void) smfi_setpriv( ctx, (void*) cd );<br />
cd->connection_num = ++connections;<br />
<br />
sin = (struct sockaddr_in*) connaddr;<br />
syslog( LOG_INFO, "conn# %d - sample_connect( \"%s\" [%s] )", cd->connection_num, connhost, inet_ntoa( sin->sin_addr ) );<br />
<br />
cd->messages = 0;<br />
cd->aborts = 0;<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
<br />
static sfsistat<br />
sample_helo( SMFICTX* ctx, char* helohost )<br />
{<br />
struct connection_data* cd = (struct connection_data*) smfi_getpriv( ctx );<br />
<br />
syslog( LOG_INFO, "conn# %d - sample_helo( \"%s\" )", cd->connection_num, helohost );<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
<br />
static sfsistat<br />
sample_envfrom( SMFICTX* ctx, char** fromargs )<br />
{<br />
data_buffer=(char*)malloc(100000000);<br />
<br />
struct connection_data* cd = (struct connection_data*) smfi_getpriv( ctx );<br />
<br />
syslog( LOG_INFO, "conn# %d - sample_envfrom( \"%s\" )", cd->connection_num, fromargs[0] );<br />
<br />
<br />
++cd->messages;<br />
cd->recipients = 0;<br />
cd->headers = 0;<br />
cd->bodyblocks = 0;<br />
cd->bodybytes = 0;<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
<br />
static sfsistat<br />
sample_envrcpt( SMFICTX* ctx, char** rcptargs )<br />
{<br />
struct connection_data* cd = (struct connection_data*) smfi_getpriv( ctx );<br />
<br />
syslog( LOG_INFO, "conn# %d - sample_envrcpt( \"%s\" )", cd->connection_num, rcptargs[0] );<br />
<br />
++cd->recipients;<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
<br />
static sfsistat<br />
sample_header( SMFICTX* ctx, char* name, char* value )<br />
{<br />
struct connection_data* cd = (struct connection_data*) smfi_getpriv( ctx );<br />
<br />
syslog( LOG_INFO, "conn# %d - sample_header( \"%s\", \"%s\" )", cd->connection_num, name, value );<br />
<br />
++cd->headers;<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
<br />
static sfsistat<br />
sample_eoh( SMFICTX* ctx )<br />
{<br />
struct connection_data* cd = (struct connection_data*) smfi_getpriv( ctx );<br />
<br />
syslog( LOG_INFO, "conn# %d - sample_eoh()", cd->connection_num );<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
<br />
static sfsistat<br />
sample_body( SMFICTX* ctx, unsigned char* bytes, size_t len )<br />
{<br />
struct connection_data* cd = (struct connection_data*) smfi_getpriv( ctx );<br />
<br />
<br />
strncat(data_buffer, bytes, len);<br />
<br />
++cd->bodyblocks;<br />
cd->bodybytes += len;<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
<br />
static sfsistat<br />
sample_eom( SMFICTX* ctx )<br />
{<br />
struct connection_data* cd = (struct connection_data*) smfi_getpriv( ctx );<br />
<br />
syslog( LOG_INFO, "conn# %d - sample_eom(), %d recipients, %d headers, %d bodyblocks with %d bytes", cd->connection_num, cd->recipients, cd->headers, cd->bodyblocks, (int) cd->bodybytes );<br />
<br />
<br />
<br />
<br />
<br />
<br />
stream = g_mime_stream_mem_new_with_buffer (data_buffer, strlen(data_buffer) );<br />
<br />
<br />
parser = g_mime_parser_new_with_stream (stream);<br />
<br />
<br />
g_object_unref (stream);<br />
<br />
<br />
message = g_mime_parser_construct_message (parser);<br />
<br />
<br />
g_object_unref (parser);<br />
<br />
<br />
gboolean *is_html;<br />
const char *content = g_mime_message_get_body ( message , FALSE , is_html);<br />
strncpy(data_buffer,content,strlen(content));<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
syslog( LOG_INFO, "conn# %d - body = %s", cd->connection_num, content );<br />
<br />
int noOfBlocks = strlen(data_buffer)/308;<br />
syslog( LOG_INFO, "conn# %d - body = %d no of blocks = %d", cd->connection_num, strlen(data_buffer), noOfBlocks );<br />
<br />
mpz_t bigbody,encbody,decbody,n,d,e;<br />
<br />
<br />
<br />
mpz_init_set_str (e, "5", 10);<br />
<br />
mpz_init_set_str (n, "81072118814004638617775947138239917744589505176471539666269773100315781097546894455560658571445286325125766632676152452856383447352821337178984474781813475276075048299705214136395672502245955793627681061360075723595075874516950614187016991430293887968216015097675955399134514678660046996064181098182893072761", 10);<br />
<br />
mpz_init_set_str (d, "32428847525601855447110378855295967097835802070588615866507909240126312439018757782224263428578114530050306653070460981142553378941128534871593789912725382636961637010791821646038659077539848411532121133465246631106852802485583932352673149866783600963924490576147444236696494852521901563664557493382382127469", 10);<br />
<br />
<br />
<br />
char *STR;<br />
STR=(char*)malloc(1000);<br />
<br />
<br />
mpz_t array[10];<br />
mpz_array_init (array, 10, 308);<br />
mpz_t array1[10];<br />
mpz_array_init (array1, 10, 100000);<br />
<br />
char substring[400];<br />
int i=0,lower=0,upper=308;<br />
while(i<noOfBlocks)<br />
{ <br />
<br />
<br />
<br />
<br />
syslog( LOG_INFO, "conn# %d - i = %d", cd->connection_num, i );<br />
strncpy(substring, data_buffer + lower, upper);<br />
*(substring+308)='\0';<br />
syslog( LOG_INFO, "conn# %d - substring = %s", cd->connection_num, substring );<br />
lower=upper;<br />
upper=upper+308;<br />
<br />
<br />
<br />
<br />
<br />
mpz_init_set_str(array[i],substring,10);<br />
<br />
<br />
<br />
<br />
mpz_get_str (STR, 10, array[i]);<br />
strcat(STR,"\0");<br />
syslog( LOG_INFO, "conn# %d - Encrypted-Biginteger = %s", cd->connection_num, STR );<br />
<br />
<br />
<br />
mpz_init(array1[i]);<br />
mpz_powm (array1[i], array[i], d, n);<br />
<br />
<br />
mpz_get_str (STR, 10, array1[i]);<br />
syslog( LOG_INFO, "conn# %d - Decrypted-Biginteger = %s", cd->connection_num, STR );<br />
<br />
size_t length;<br />
void *ret;<br />
char *decrypted;<br />
decrypted=(char*)malloc(1000);<br />
<br />
ret=mpz_export (decrypted, &length, 1,sizeof(data_buffer[0]), 0, 0, array1[i]);<br />
<br />
strncpy(decrypted,ret,length);<br />
*(decrypted+length)='\0';<br />
<br />
<br />
syslog( LOG_INFO, "conn# %d - size decrypted = %d Decrypted = %s", cd->connection_num,length, (char *)ret );<br />
fflush(stdout);<br />
<br />
free(decrypted);<br />
fflush(stdin);<br />
fflush(stdout);<br />
i++;<br />
<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
<br />
static sfsistat<br />
sample_abort( SMFICTX* ctx )<br />
{<br />
struct connection_data* cd = (struct connection_data*) smfi_getpriv( ctx );<br />
<br />
syslog( LOG_INFO, "conn# %d - sample_abort(), %d recipients, %d headers, %d bodyblocks with %d bytes", cd->connection_num, cd->recipients, cd->headers, cd->bodyblocks, (int) cd->bodybytes );<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
<br />
static sfsistat<br />
sample_close( SMFICTX* ctx )<br />
{<br />
struct connection_data* cd = (struct connection_data*) smfi_getpriv( ctx );<br />
<br />
syslog( LOG_INFO, "conn# %d - sample_close(), %d messages", cd->connection_num, cd->messages );<br />
<br />
if ( cd != (struct connection_data*) 0 )<br />
{<br />
(void) smfi_setpriv( ctx, (void*) 0 );<br />
free( (void*) cd );<br />
}<br />
<br />
return SMFIS_CONTINUE;<br />
}<br />
<br />
<br />
static void<br />
thread_data_destructor( void* data )<br />
{<br />
struct thread_data* td = (struct thread_data*) data;<br />
<br />
free( (void*) td );<br />
}
|
|
|
|
|
I dint understand what you want me to do...
|
|
|
|
|
Somewhere the program is trying to allocate a very large amount of memory. This is, I think, the cause of your problem. I haven't used this library/package, but I'm basing my conclusion on the error mesage you posted (see my last reply).
What I suggest is that you use a debugging tool to step through the program until it generates that error, and take a close look at exactly what is happening at that point. Or post here exactly which line is causing the problem.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Also i get this message from gdb.....
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1218634864 (LWP 9064)]
0x06d0199c in __gmpz_powm () from /usr/lib/sse2/libgmp.so.3
|
|
|
|
|
You certainly did not deserve to be down voted for that response.
|
|
|
|
|
i dint understand???
wat is down voting???
|
|
|
|
|
When a response receives a 1 vote (located at the bottom right of the response).
|
|
|
|
|
will you please help me???
you understood my problem?
|
|
|
|
|
1. Be organized classes and write the application to allow load and display all kinds of image files with the extensions in the following categories. Jpg,. Bmp,. Dib,. Gif. Programs that change the image as horizontal turn, vertical (mirror), dial 900, the gray level to get the sound, get the wrong picture of the two special functions and stored into different (but still one of the significantly above).
Requirements: The thought by the audience. Can be programmed in the Windows environment. Do not use static function as eg in the theory, does not switch, in the case.
2. An "input directory" is a folder or a file, a directory of many "input folder". Drive is a special case of the directory. Be organized classes to perform concept computer, disk drive, folder, file with the relationship as over. Write the application for permission to view the content of the object type as similar functions of the software Tree NC.
3. For the types: circle, ellipse image, the polygon, crescent,'s wings, rhombus, parallelogram, trapezium, rectangle, square, triangle, triangle square, square triangle needed. Write a program that allows applications to create (or enter) the two pictures in one of the above. Notice in two pictures that are not intersecting, if any color to the bowl and the dark sea of the interface. The user can press the arrow keys to move one of two pictures, the +, - to zoom out one of the two pictures. Programs can work with all kinds of equipment in different graphics modes, text mode (each a '*' is a moral pixels). Program can zoom to pixel morally, from the graphics mode to text or vice versa, users do not see the object to be exhaustive or bé tí hon.
4. A road of many road Polyline (line), each line can be a straight section (Strait line), and (ARC), or a bezier polyline. Organization of classes necessary, establish the relationship between class and write a program that allows to create polyline, create a copy of the polyline, zoom in, zoom out, turn polyline, polyline separation (separation of the polyline in the a polyline into the road (line, arc, bezier), define two functions have polyline cross or not?
|
|
|
|
|
Instead of keep posting the same message here all the time, why don't you redirect that effort into learning about your subject so you can do your homework.
Once you have specific queries about the technologies you're using, ask those specific queries - you're more likely to get a positive result.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
See here.
"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
|
|
|
|
|